Core Resources
Discounts
Discounts can be applied to checkout, or can be applied directly to an address. Depending on configuration they allow for single use, or recurring discounts.
Often discounts can be used combination with webhooks, such that when a specific event comes, it can apply a discount dependent on custom business logic.
There are various options that can be utilized for discounts such as minimum price, single use, recurring for a set number of charges, or ongoing. You can also set the date from which time the discount will become applicable begin, and when it can no longer be applied to a new subscription.
Often discounts can be used combination with webhooks, such that when a specific event comes, it can apply a discount dependent on custom business logic.
There are various options that can be utilized for discounts such as minimum price, single use, recurring for a set number of charges, or ongoing. You can also set the date from which time the discount will become applicable begin, and when it can no longer be applied to a new subscription.
#The discount object
These fields are deprecated, however they will not be removed from this API version.
applies_to is deprecated. Use applies_to_id and applies_to_resource instead.
applies_to is deprecated. Use applies_to_id and applies_to_resource instead.
Attributes
- idintegerUnique numeric identifier for the customer.
- applies_to_idintegerApplied to id of the product or collection where the id is the id of the shopify product or the shopify custom collection id.
- applies_to_product_typestringSets the specific product type the discount applies to.Possible values
ALLONETIMESUBSCRIPTION - Applied to a specific product or collection.Possible values
shopify_productshopify_collection_id - channel_settingsobjectA list of channel objects containing information regarding discount behaviors for each.
* can_apply: a boolean to indicate if the discount may be applied using the associated channel (defaults to true for all channels).
If you're on the SCI Platform, checkout channel will not apply during Shopify checkouts. - codestringThe name of the discount.
- created_atdatetimeThe date and time when the discount was created.
- discount_typestringThe type of discount. Either percentage or
fixed_amount. - durationstringNumber of times a discount will be automatically re-applied to a new queued charge after its first usage on a successful charge. Values can be: forever will re-apply unlimited times usage_limit number of times will be set in duration_usage_limit single_use it will not re-apply.
- duration_usage_limitintegerSpecific number of times a discount will be automatically re-applied to a new queued charge after its first usage on a successful charge. *Only used, and is required, when “duration” is set to “usage_limit”.
- ends_atdatetimeThe expiration timestamp of the discount. Past this time the
Discountcan no longer be redeemed. Afterends_atthestatusof theDiscountwill go fromactivetodisabled.Recurring discounts applied prior to theirends_attime will still apply. - Discount can be used on checkout for customer that still don’t exist in Recharge database. Default value is null.
- once_per_customerbooleanThe discount can only be used once for a given customer checkout or manually applied once on the customer portal (irrespective of which address). Once applied, it will continue being re-applied to each new charge on the address, unless the discount_duration attribute specifies otherwise.
- prerequisite_subtotal_minintegerThe minimum cart subtotal needed for the discount to be applicable.
- starts_atdatetimeThe date when the discount becomes active.When not specified on creation
starts_atwill default tonullwhich translates into no restrictions. - statusstringThe status of the discount. Value can be:
*enableddiscount is active to be applied
*disableddiscount can’t be applied on new purchases. Discount will remain on existing charges to which it has already been applied.
*fully_disableddiscount can no longer be applied. In addition,Discountis removed from every queued charge.disabledandfully_disabledcan both be reverted toenabled. However once aDiscounthas been updated tofully_disabledit will be removed from allChargesit had been applied to. This removal fromChargesis irreversible. - times_usedintegerNumber of times a discount was used by customers at checkout.
- updated_atdatetimeThe date and time when the discount was last updated.
- usage_limitintegerSets the limit on the number of times a discount can be used by all customers.
- valuestringThe discounted value to be applied.
{
"discount": {
"id": 3748296,
"applies_to": null,
"applies_to_id": null,
"applies_to_product_type": "ALL",
"applies_to_resource": null,
"channel_settings": {
"api": {
"can_apply": false
},
"checkout_page": {
"can_apply": true
},
"customer_portal": {
"can_apply": true
},
"merchant_portal": {
"can_apply": false
}
},
"code": "Discount1",
"created_at": "2018-04-25T14:32:39",
"discount_type": "percentage",
"duration": "usage_limit",
"duration_usage_limit": 10,
"ends_at": "2019-12-15T00:00:00",
"once_per_customer": false,
"prerequisite_subtotal_min": null,
"starts_at": "2018-05-16T00:00:00",
"status": "enabled",
"times_used": 0,
"updated_at": "2018-05-04T13:33:53",
"usage_limit": 10,
"value": 12
}
}#Create a discount
POST/discounts
Create a new discount.
With the new 'prerequisite_subtotal_min' attribute, you can create discounts that can be applied only if the cart subtotal exceeds a set amount.
Body parameters
- applies_to_idintegerApplied to id of the product or collection where the id is the id of the shopify product or the shopify custom collection id.
- applies_to_product_typestringSets the specific product type the discount applies to.Possible values
ALLONETIMESUBSCRIPTION - Applied to a specific product or collection.Possible values
shopify_productshopify_collection_id - channel_settingsobjectA list of channel objects containing information regarding discount behaviors for each.
* can_apply: a boolean to indicate if the discount may be applied using the associated channel (defaults to true for all channels). - The name of the discount.
- created_atdatetimeThe date and time when the discount was created.
- The type of discount. Either percentage or
fixed_amount. - Number of times a discount will be automatically re-applied to a new queued charge after its first usage on a successful charge. Values can be: forever will re-apply unlimited times usage_limit number of times will be set in duration_usage_limit single_use it will not re-apply.
- Specific number of times a discount will be automatically re-applied to a new queued charge after its first usage on a successful charge. *Only used, and is required, when “duration” is set to “usage_limit”.
- ends_atdatetimeThe expiration timestamp of the discount. Past this time the
Discountcan no longer be redeemed. Afterends_atthestatusof theDiscountwill go fromactivetodisabled.Recurring discounts applied prior to theirends_attime will still apply. - Discount can be used on checkout for customer that still don’t exist in Recharge database. Default value is null.Possible values
nullcustomer_must_not_exist_in_recharge - once_per_customerbooleanThe discount can only be used once for a given customer checkout or manually applied once on the customer portal (irrespective of which address). Once applied, it will continue being re-applied to each new charge on the address, unless the discount_duration attribute specifies otherwise.
- prerequisite_subtotal_minintegerThe minimum cart subtotal needed for the discount to be applicable.
- starts_atdatetimeThe date when the discount becomes active.When not specified on creation
starts_atwill default tonullwhich translates into no restrictions. - statusstringThe status of the discount. Value can be:
*enableddiscount is active to be applied
*disableddiscount can’t be applied on new purchases. Discount will remain on existing charges to which it has already been applied.
*fully_disableddiscount can no longer be applied. In addition,Discountis removed from every queued charge.disabledandfully_disabledcan both be reverted toenabled. However once aDiscounthas been updated tofully_disabledit will be removed from allChargesit had been applied to. This removal fromChargesis irreversible. - usage_limitintegerSets the limit on the number of times a discount can be used by all customers.
- The discounted value to be applied.
curl -X POST 'https://api.rechargeapps.com/discounts' \
-H 'Content-Type: application/json' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{
"applies_to_product_type": "ONETIME",
"channel_settings": {
"api": {
"can_apply": false
},
"checkout_page": {
"can_apply": true
},
"customer_portal": {
"can_apply": true
},
"merchant_portal": {
"can_apply": false
}
},
"code": "Discount",
"discount_type": "percentage",
"duration": "usage_limit",
"duration_usage_limit": 1,
"ends_at": "2023-12-31",
"starts_at": "2018-05-16",
"status": "enabled",
"usage_limit": 1,
"value": 12
}'{
"discount": {
"id": 3425307,
"applies_to": null,
"applies_to_id": null,
"applies_to_product_type": "ONETIME",
"applies_to_resource": null,
"channel_settings": {
"api": {
"can_apply": false
},
"checkout_page": {
"can_apply": true
},
"customer_portal": {
"can_apply": true
},
"merchant_portal": {
"can_apply": false
}
},
"code": "Discount",
"created_at": "2018-04-13T10:00:01",
"discount_type": "percentage",
"duration": "usage_limit",
"duration_usage_limit": 1,
"ends_at": "2023-12-31T00:00:00",
"once_per_customer": false,
"prerequisite_subtotal_min": null,
"starts_at": "2018-05-16T00:00:00",
"status": "enabled",
"times_used": 0,
"updated_at": "2019-10-16T10:03:38",
"usage_limit": 1,
"value": 12
}
}curl 'https://api.rechargeapps.com/discounts/1234567' \
-H 'X-Recharge-Access-Token: your_api_token'{
"discount": {
"id": 3425307,
"applies_to": null,
"applies_to_id": null,
"applies_to_product_type": "ONETIME",
"applies_to_resource": null,
"channel_settings": {
"api": {
"can_apply": false
},
"checkout_page": {
"can_apply": true
},
"customer_portal": {
"can_apply": true
},
"merchant_portal": {
"can_apply": false
}
},
"code": "Discount",
"created_at": "2018-04-13T10:00:01",
"discount_type": "percentage",
"duration": "usage_limit",
"duration_usage_limit": 1,
"ends_at": "2023-12-31T00:00:00",
"once_per_customer": false,
"prerequisite_subtotal_min": null,
"starts_at": "2018-05-16T00:00:00",
"status": "enabled",
"times_used": 0,
"updated_at": "2019-10-16T10:03:38",
"usage_limit": 1,
"value": 12
}
}#Update a discount
PUT/discounts/{id}
You can now modify an existing discount to match the specified parameters.
Body parameters
- channel_settingsstringA list of channel objects containing information regarding discount behaviors for each.
* can_apply: a boolean to indicate if the discount may be applied using the associated channel (defaults to true for all channels). - ends_atdatetimeThe date when the discount will end.
- starts_atdatetimeThe date when the discount will start.
- statusstringThe status of the discount. Value can be:
*enableddiscount is active to be applied
*disableddiscount can’t be applied on new purchases. Discount will remain on existing charges to which it has already been applied.
*fully_disableddiscount can no longer be applied. In addition,Discountis removed from every queued charge.disabledandfully_disabledcan both be reverted toenabled. However once aDiscounthas been updated tofully_disabledit will be removed from allChargesit had been applied to. This removal fromChargesis irreversible. - usage_limitintegerThe limit in which a discount can be used.
curl -X PUT 'https://api.rechargeapps.com/discounts/11127406' \
-H 'Content-Type: application/json' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{
"starts_at": "2021-12-06",
"usage_limit": 10
}'{
"discount": {
"id": 3425307,
"applies_to": null,
"applies_to_id": null,
"applies_to_product_type": "ONETIME",
"applies_to_resource": null,
"channel_settings": {
"api": {
"can_apply": false
},
"checkout_page": {
"can_apply": true
},
"customer_portal": {
"can_apply": true
},
"merchant_portal": {
"can_apply": false
}
},
"code": "Discount",
"created_at": "2018-04-13T10:00:01",
"discount_type": "percentage",
"duration": "usage_limit",
"duration_usage_limit": 1,
"ends_at": "2023-12-31T00:00:00",
"once_per_customer": false,
"prerequisite_subtotal_min": null,
"starts_at": "2018-05-16T00:00:00",
"status": "enabled",
"times_used": 0,
"updated_at": "2019-10-16T10:03:38",
"usage_limit": 1,
"value": 12
}
}#Delete a discount
DELETE/discounts/{id}
Delete a discount
For safety reasons, to delete a discount you will need to set its status to fully_disabled.
For safety reasons, to delete a discount you will need to set its status to fully_disabled.
curl -X DELETE 'https://api.rechargeapps.com/discounts/12081717' \
-H 'X-Recharge-Access-Token: your_api_token'{}#List discounts
GET/discounts
Return a list of discounts in your store.
## HTTP request examples
## HTTP request examples
GET /discounts GET /discounts?created_at_max=2017-10-01 GET /discounts?created_at_max=2017-10-01 GET /discounts?created_at_min=2017-10-01 GET /discounts?discount_code=DiscountGET /discounts?discount_type=percentage GET /discounts?updated_at_min=2017-10-01Query parameters
- created_at_maxstringGet all discounts created before a specified date.
- created_at_minstringGet all discounts created after a specified date.
- discount_codestringSearch for a particular discount code.
- discount_typestringType of discount. Value can be
percentageorfixed_amount. - idsstringFilter discounts by id. If passing multiple values, must be comma separated. Non-integer values will result in a 422 error
- limitstringNumber of results.
(default:50) (maximum: 250) - Page to show.Page-based pagination has been deprecated but still available to use for pages up to a 100. If you need data past this point, use cursor pagination.
- statusstringReturns all discounts with status
enabledordisabled. - updated_at_maxstringGet all discounts updated before a specified date.
- updated_at_minstringGet all discounts updated after a specified date.
curl 'https://api.rechargeapps.com/discounts' \
-H 'X-Recharge-Access-Token: your_api_token' \ n -d limit=3 -G{
"discounts": [
{
"id": 3748296,
"applies_to": null,
"applies_to_id": null,
"applies_to_product_type": "ALL",
"applies_to_resource": null,
"channel_settings": {
"api": {
"can_apply": false
},
"checkout_page": {
"can_apply": true
},
"customer_portal": {
"can_apply": true
},
"merchant_portal": {
"can_apply": false
}
},
"code": "Discount1",
"created_at": "2018-04-25T14:32:39",
"discount_type": "percentage",
"duration": "usage_limit",
"duration_usage_limit": 10,
"ends_at": "2019-12-15T00:00:00",
"once_per_customer": false,
"prerequisite_subtotal_min": null,
"starts_at": "2018-05-16T00:00:00",
"status": "enabled",
"times_used": 0,
"updated_at": "2018-05-04T13:33:53",
"usage_limit": 10,
"value": 12
}
]
}#Count discounts
GET/discounts/count
Receive a count of all discounts.
## HTTP request examples
## HTTP request examples
GET /discounts/count GET /discounts/count?created_at_min=2019-11-10&created_at_max=2019-11-11 GET /discounts/count?discount_type=percentage GET /discounts/count?status=enabled GET /discounts/count?updated_at_min=2019-11-10&updated_at_max=2019-11-11Query parameters
- created_at_maxstringReturns the count of discounts created before a specified date.
- created_at_minstringReturns the count of discounts created after a specified date.
- discount_typestringReturns the count of discounts that are of a given type. Value can be percentage,
fixed_amountorshipping. - statusstringReturns the count of discounts with status of
enabledordisabled. - updated_at_maxstringReturns the count of discounts updated before a specified date.
- updated_at_minstringReturns the count of discounts updated after a specified date.
Response attributes
- countinteger
curl 'https://api.rechargeapps.com/discounts/count' \
-H 'X-Recharge-Access-Token: your_api_token'{
"count": 12057
}#Apply a discount to an address
POST/addresses/{id}/apply_discount
New endpoint for adding a discount to an existing address.
NOTE: cannot add another discount if the address already has a discount. Also cannot add if an existing queued charge in the address already has a discount.
Body parameters
- discount_codestringCode of the discount you want to apply to an address.
- discount_idintegerId of the discount you want to apply to an address.
Response attributes
- idintegerThe unique numeric identifier for the charge.
- address_idintegerThe customer shipping address the charge is tied to.
- analytics_dataobjectAn object containing analytics data associated with the charge.
Show child attributesHide child attributes1
- utm_paramsarray of objectsAn array containing
utm_parameterswhich are commonly used to store the details of an acquisition campaign.Show child attributesHide child attributes7
- utm_campaignstringThe utm campaign details.
- utm_contentstringThe utm content.
- utm_data_sourcestringThe source of the campaign parameter.
- utm_sourcestringThe utm source.
- utm_mediumstringThe utm medium.
- utm_termstringThe utm term.
- utm_timestampstringThe utm timestamp.
- billing_addressobjectAll the billing information related to the charge.
Show child attributesHide child attributes10
- address1stringLine one of the billing address.
- address2stringLine two of the billing address.
- citystringThe city of the billing address.
- companystringThe company name of the billing address.
- countrystringThe country of the billing address.
- first_namestringThe first name of the billing address.
- last_namestringThe last name of the billing address.
- phonestringThe phone number of the billing address.
- provincestringThe name of the province or state associated with the billing address.
- zipstringThe zip code of the billing address.
- client_detailsobjectDetails of the access method used by the purchaser.
Show child attributesHide child attributes2
- browser_ipstringThe IP address of the buyer as detected in checkout.
- user_agentstringThe user agent detected during checkout.
- created_atdatetimeWhen the
Chargewas created. - customer_hashstringThe
hashof theCustomerassociated with the charge. - customer_idstringThe
idof theCustomerassociated with the charge. - discount_codesobjectAn array of discounts associated with the charge.
Show child attributesHide child attributes4
- recharge_discount_idintegerThe id of a discount associated with this charge.
- codestringThe code of the discount applied on this charge.
- valuefloatThe value of the discount applied to the charge.
- typestringThe type of the value of the discount applied to the charge (percentage, fixed_amount).
- emailstringThe email address of the customer.
- first_namestringThe first name of the customer.
- Specifies whether the charge is scheduled for a regeneration (if the subscription related to the charge was updated in the last 5 seconds using “commit_update”:false).
- last_namestringThe last name of the customer.
- line_itemsarray of objectsA list of
line_itemobjects, each one containing information about an item in the charge. Oneline_itemper subscription.Show child attributesHide child attributes12
- gramintegerWeight in gram of the item.
- imagesobjectWeight in gram of the item.
- original_pricestringThe original price of the item without discounts or taxes.
- pricestringThe price of the item.
- propertiesarray of objectsAn array of
Propertyobject containing customer information for an item. - quantityintegerThe number of products that were purchased.
- shopify_product_idintegerThe unique numeric identifier for the Shopify product in the fulfillment.
- shopify_variant_idintegerThe id of the Shopify product variant.
- skustringA unique identifier of the item in the fulfillment.
- titlestringThe title of the product.
- variant_titlestringThe title of the product variant.
- subscription_idintegerThe id of the corresponding
Subscription.
- notestringShows the next order in sequence.
- note_attributesarray of objectsnote attributes.
- processor_namestringThe payment processor used on the charge.
- processed_atdatetimeThe date and time when the transaction was processed.
- scheduled_atdatetimeWhen the charge processing will next be attempted.If a charge failed to process,
scheduled_atremains the initial scheduled date of the processing not the date of the next attempt. - shipments_countintegerThe number of successfully processed child orders on the charge.
- shipping_addressobjectThe shipping address of the shipping address.
Show child attributesHide child attributes10
- address1stringLine one of the billing address.
- address2stringLine two of the billing address.
- citystringThe city of the billing address.
- companystringThe company name of the billing address.
- countrystringThe country of the billing address.
- first_namestringThe first name of the billing address.
- last_namestringThe last name of the billing address.
- phonestringThe phone number of the billing address.
- provincestringThe name of the province or state associated with the billing address.
- zipstringThe zip code of the billing address.
- shipping_linesarray of objectsAn array of shipping lines associated with the charge.
Show child attributesHide child attributes5
- shopify_order_idintegerThe unique numeric identifier within Shopify for the charge
- statusstringThe status of the charge.Possible values
SUCCESSERRORQUEUEDSKIPPEDREFUNDEDPARTIALLY_REFUNDED - The item price without taxes and discounts. Use subtotal_price instead.
- subtotal_pricestringThe item price without taxes and shipping.
- tax_linesarray of objectsArray of strings used to distinguish specific charges.
Show child attributesHide child attributes5
- total_discountsstringThe sum of the discounts applied to the
Charge. - total_line_items_pricestringThe sum of all the prices of all the items in the charge.
- total_pricestringThe sum of all the prices of all the items in the charge, taxes and discounts included (must be positive).
- total_refundsstringThe sum of all refunds that were made on specific charge.
- total_weightstringThe sum of all refunds that were made on specific charge.
- transaction_idstringThe unique alphanumeric identifier of the transaction.
- typestringThe type of the charge.Possible values
CHECKOUTRECURRING - updated_atdatetimeThe date and time when the
Chargewas last updated. - errorstringError reason as sentence text (typically returned direct from the payment processor). e.g.
"Customer needs to update credit card" - error_typestringStructured reason why the charge failed such as
CUSTOMER_NEEDS_TO_UPDATE_CARD - last_charge_attempt_datedatetimeThe date when a charge was last attempted.
- number_times_triedintegerShows how many times an attempt to charge was placed.
- retry_datedateThe date when the next attempt will be placed.
- shopify_variant_id_not_foundintegerIndicates if Recharge was able to find the
shopify_variant_idfrom the charge.
curl -X POST 'https://api.rechargeapps.com/addresses/26031022/apply_discount' \
-H 'Content-Type: application/json' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{
"discount_id": 12406728
}'{
"address": {
"id": 26031022,
"address1": "200 Bay St.",
"address2": "",
"cart_attributes": [],
"cart_note": "",
"city": "Toronto",
"company": "",
"country": "Canada",
"created_at": "2019-01-14T22:18:56",
"customer_id": 23124211,
"discount_id": 12406728,
"first_name": "R",
"last_name": "S",
"note_attributes": [],
"original_shipping_lines": [],
"phone": "4163536363",
"province": "Ontario",
"shipping_lines_override": null,
"updated_at": "2019-01-15T11:03:11",
"zip": "M9P 2b6"
}
}#Apply a discount to a charge
POST/charges/{id}/apply_discount
New endpoint for adding discount to an existing queued charge.
NOTE: You cannot add another discount to an existing queued charge if the charge already has a discount. Also cannot add if the address has an existing discount.
NOTE: You can provide either discount_id or discount_code. If both parameters are passed, the value for discount_id will override the value in discount_code.
NOTE: You cannot add another discount to an existing queued charge if the charge already has a discount. Also cannot add if the address has an existing discount.
NOTE: You can provide either discount_id or discount_code. If both parameters are passed, the value for discount_id will override the value in discount_code.
If a charge has a discount and it gets updated or a regeneration occurs, the discount will be lost.
Regeneration is a process that refreshes the charge JSON with new data in the case of the subscription/address being updated.
Regeneration is a process that refreshes the charge JSON with new data in the case of the subscription/address being updated.
Body parameters
- discount_codestringCode of the discount you want to apply to a charge.
- discount_idintegerId of the discount you want to apply to a charge.
Response attributes
- idintegerUnique numeric identifier for the
Address. - address1stringThe street associated with the
Address. - address2stringAny additional information associated with the shipping address.
- The note that that will be passed to the
notefield ofOrdersmade within theAddress.cart_noteis not currently honored when sent to the Shopify contract api (SCI). - citystringThe city associated with the shipping address.
- companystringThe company associated with the shipping address.
- countrystringThe country associated with the shipping address.
- country_codestringThe 2-letter country code.
- customer_idintegerUnique numeric identifier for the
Customerassociated with theAddress. - discount_idintegerUnique numeric identifier of
Discountthat is applied on theAddress. - first_namestringThe customer’s first name associated with the address.
- last_namestringThe customer’s last name associated with the address.
- note_attributesarray of objectsExtra information that is added to the order.
- phonestringThe phone number associated with the address.
- Presentment currency is the currency used to display prices to the associated on a storefront and at checkout.Only set if the currency is different from the store-level currency. Else, will default to store-level currency.
- provincestringThe state or province associated with the address.
- shipping_lines_overridearray of objectsUsed when shipping rates need to be overridden. If this parameter has value
null, rates will be fetched when a relatedChargeis created or regenerated - zipstringThe zip or postal code associated with the address.
- cart_attributesarrayAdditional information added to an initial order.Important: This field will be deprecated. Please use
note_attributesinstead. - created_atdatetimeThe date and time when the address was created.
- Shipping line details.Important: This field will be deprecated. Please use
shipping_lines_overrideinstead. - updated_atdatetimeThe date and time when the
Addresswas last updated.
curl -X POST 'https://api.rechargeapps.com/charges/105805051/apply_discount' \
-H 'Content-Type: application/json' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{
"discount_code": "test"
}'{
"charge": {
"id": 105805051,
"address_id": 22369585,
"billing_address": {
"province": "California",
"city": "Los Angeles",
"first_name": "Mike",
"last_name": "Flynn",
"zip": "90404",
"country": "United States",
"address1": "3030 Nebraska Avenue",
"address2": null,
"company": null,
"phone": "3103843698"
},
"client_details": {
"user_agent": null,
"browser_ip": null
},
"created_at": "2018-11-28T08:51:50",
"customer_hash": null,
"customer_id": 18819267,
"discount_codes": [
{
"amount": "12.00",
"code": "test",
"type": "percentage"
}
],
"email": null,
"first_name": null,
"has_uncommited_changes": false,
"last_name": null,
"line_items": [
{
"grams": 0,
"original_price": "9.00",
"price": "9.00",
"quantity": 1,
"shopify_product_id": "1255175363",
"shopify_variant_id": "3844892483",
"sku": "test",
"subscription_id": 28835632,
"title": "SuperKiwi ONETIME",
"variant_title": "6oz",
"properties": [
{
"name": "grind",
"value": "drip"
}
]
}
],
"note": " next order #1 - Subscription Recurring Order",
"note_attributes": null,
"scheduled_at": "2018-11-30T00:00:00",
"shipments_count": null,
"shipping_address": {
"address1": "2298 Primrose Lane",
"address2": "",
"city": "Richland Center",
"company": "Recharge",
"country": "United States",
"first_name": "Sherman",
"last_name": "Rivas",
"phone": "6086493200",
"province": "Wisconsin",
"zip": "53581"
},
"shipping_lines": [
{
"code": "Standard Shipping",
"price": "0.00",
"title": "Standard Shipping"
}
],
"shopify_order_id": null,
"status": "QUEUED",
"sub_total": null,
"subtotal_price": 7.92,
"tags": "Subscription, Subscription Recurring Order",
"tax_lines": 0.38,
"total_discounts": "1.08",
"total_line_items_price": "9.00",
"total_price": "7.92",
"total_refunds": null,
"total_tax": 0.38,
"total_weight": 0,
"type": "RECURRING",
"updated_at": "2019-01-15T11:32:53"
}
}#Remove a discount
POST/addresses/{id}/remove_discount
Remove a discount from a charge or address without destroying the discount.
In most of the cases the discount should be removed from the address. When the discount is removed from the address the discount is also removed from any future charges.
## HTTP request examples
If the discount is on the parent address, you cannot remove that discount using charge_id. When removing your discount it is preferable to pass the address_id so that the discount stays removed in case the charge is regenerated. Only pass charge_id in edge cases in which there are two or more charges on a parent address and you only want to remove the discount from one charge. If you pass both parameters, it will remove the discount from the address.
In most of the cases the discount should be removed from the address. When the discount is removed from the address the discount is also removed from any future charges.
## HTTP request examples
POST /addresses/<address_id>/remove_discount/ POST /charges/<charge_id>/remove_discount/If the discount is on the parent address, you cannot remove that discount using charge_id. When removing your discount it is preferable to pass the address_id so that the discount stays removed in case the charge is regenerated. Only pass charge_id in edge cases in which there are two or more charges on a parent address and you only want to remove the discount from one charge. If you pass both parameters, it will remove the discount from the address.
Body parameters
- address_idintegerUnique numeric identifier for address from which you want to remove the discount.
- charge_idintegerUnique numeric identifier of the charge from which you want to remove the discount.
Response attributes
- idintegerUnique numeric identifier for the
Address. - address1stringThe street associated with the
Address. - address2stringAny additional information associated with the shipping address.
- The note that that will be passed to the
notefield ofOrdersmade within theAddress.cart_noteis not currently honored when sent to the Shopify contract api (SCI). - citystringThe city associated with the shipping address.
- companystringThe company associated with the shipping address.
- countrystringThe country associated with the shipping address.
- country_codestringThe 2-letter country code.
- customer_idintegerUnique numeric identifier for the
Customerassociated with theAddress. - discount_idintegerUnique numeric identifier of
Discountthat is applied on theAddress. - first_namestringThe customer’s first name associated with the address.
- last_namestringThe customer’s last name associated with the address.
- note_attributesarray of objectsExtra information that is added to the order.
- phonestringThe phone number associated with the address.
- Presentment currency is the currency used to display prices to the associated on a storefront and at checkout.Only set if the currency is different from the store-level currency. Else, will default to store-level currency.
- provincestringThe state or province associated with the address.
- shipping_lines_overridearray of objectsUsed when shipping rates need to be overridden. If this parameter has value
null, rates will be fetched when a relatedChargeis created or regenerated - zipstringThe zip or postal code associated with the address.
- cart_attributesarrayAdditional information added to an initial order.Important: This field will be deprecated. Please use
note_attributesinstead. - created_atdatetimeThe date and time when the address was created.
- Shipping line details.Important: This field will be deprecated. Please use
shipping_lines_overrideinstead. - updated_atdatetimeThe date and time when the
Addresswas last updated.
curl -X POST 'https://api.rechargeapps.com/addresses/26031022/remove_discount' \
-H 'Content-Type: application/json' \
-H 'X-Recharge-Access-Token: your_api_token' \
-d '{}'{
"address": {
"id": 26031022,
"address1": "200 Bay St.",
"address2": "",
"cart_attributes": [],
"cart_note": "a note",
"city": "Toronto",
"company": "",
"country": "Canada",
"created_at": "2019-01-14T22:18:56",
"customer_id": 23124211,
"discount_id": null,
"first_name": "R",
"last_name": "S",
"note_attributes": [],
"original_shipping_lines": [],
"phone": "4163536363",
"province": "Ontario",
"shipping_lines_override": null,
"updated_at": "2019-01-15T11:59:14",
"zip": "M9P 2b6"
}
}