API
GuidesGet API token
You’re viewing the reference for API version 2021-01.See the latest version, 2021-11 →
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.

#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.

Attributes

  • idinteger
    Unique numeric identifier for the customer.
  • Applied to id of the product or collection where the id is the id of the shopify product or the shopify custom collection id.
  • Sets the specific product type the discount applies to.
    Possible values
    ALLONETIMESUBSCRIPTION
  • Applied to a specific product or collection.
    Possible values
    shopify_productshopify_collection_id
  • A 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.
  • codestring
    The name of the discount.
  • created_atdatetime
    The date and time when the discount was created.
  • The type of discount. Either percentage or fixed_amount.
  • durationstring
    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_atdatetime
    The expiration timestamp of the discount. Past this time the Discount can no longer be redeemed. After ends_at the status of the Discount will go from active to disabled.
    Recurring discounts applied prior to their ends_at time will still apply.
  • Discount can be used on checkout for customer that still don’t exist in Recharge database. Default value is null.
  • The 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.
  • The minimum cart subtotal needed for the discount to be applicable.
  • starts_atdatetime
    The date when the discount becomes active.
    When not specified on creation starts_at will default to null which translates into no restrictions.
  • statusstring
    The status of the discount. Value can be:
    * enabled discount is active to be applied
    * disabled discount can’t be applied on new purchases. Discount will remain on existing charges to which it has already been applied.
    * fully_disabled discount can no longer be applied. In addition, Discount is removed from every queued charge.
    disabled and fully_disabled can both be reverted to enabled. However once a Discount has been updated to fully_disabled it will be removed from all Charges it had been applied to. This removal from Charges is irreversible.
  • times_usedinteger
    Number of times a discount was used by customers at checkout.
  • updated_atdatetime
    The date and time when the discount was last updated.
  • Sets the limit on the number of times a discount can be used by all customers.
  • valuestring
    The discounted value to be applied.
The discount object
{
  "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

  • Applied to id of the product or collection where the id is the id of the shopify product or the shopify custom collection id.
  • Sets the specific product type the discount applies to.
    Possible values
    ALLONETIMESUBSCRIPTION
  • Applied to a specific product or collection.
    Possible values
    shopify_productshopify_collection_id
  • A 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).
  • codestringRequired
    The name of the discount.
  • created_atdatetime
    The date and time when the discount was created.
  • discount_typestringRequired
    The type of discount. Either percentage or fixed_amount.
  • durationstringRequired
    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.
  • duration_usage_limitintegerRequired
    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_atdatetime
    The expiration timestamp of the discount. Past this time the Discount can no longer be redeemed. After ends_at the status of the Discount will go from active to disabled.
    Recurring discounts applied prior to their ends_at time 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
  • The 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.
  • The minimum cart subtotal needed for the discount to be applicable.
  • starts_atdatetime
    The date when the discount becomes active.
    When not specified on creation starts_at will default to null which translates into no restrictions.
  • statusstring
    The status of the discount. Value can be:
    * enabled discount is active to be applied
    * disabled discount can’t be applied on new purchases. Discount will remain on existing charges to which it has already been applied.
    * fully_disabled discount can no longer be applied. In addition, Discount is removed from every queued charge.
    disabled and fully_disabled can both be reverted to enabled. However once a Discount has been updated to fully_disabled it will be removed from all Charges it had been applied to. This removal from Charges is irreversible.
  • Sets the limit on the number of times a discount can be used by all customers.
  • valuestringRequired
    The discounted value to be applied.
POST/discounts
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
}'
Response
{
  "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
  }
}

#Retrieve a discount

GET/discounts/{id}
Retrieve a Recharge Discount
GET/discounts/{id}
curl 'https://api.rechargeapps.com/discounts/1234567' \
  -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "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

  • A 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_atdatetime
    The date when the discount will end.
  • starts_atdatetime
    The date when the discount will start.
  • statusstring
    The status of the discount. Value can be:
    * enabled discount is active to be applied
    * disabled discount can’t be applied on new purchases. Discount will remain on existing charges to which it has already been applied.
    * fully_disabled discount can no longer be applied. In addition, Discount is removed from every queued charge.
    disabled and fully_disabled can both be reverted to enabled. However once a Discount has been updated to fully_disabled it will be removed from all Charges it had been applied to. This removal from Charges is irreversible.
  • The limit in which a discount can be used.
PUT/discounts/{id}
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
}'
Response
{
  "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.
DELETE/discounts/{id}
curl -X DELETE 'https://api.rechargeapps.com/discounts/12081717' \
  -H 'X-Recharge-Access-Token: your_api_token'
Response
{}

#List discounts

GET/discounts
Return a list of discounts in your store.

## 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=Discount
GET /discounts?discount_type=percentage
GET /discounts?updated_at_min=2017-10-01

Query parameters

  • Get all discounts created before a specified date.
  • Get all discounts created after a specified date.
  • Search for a particular discount code.
  • Type of discount. Value can be percentage or fixed_amount.
  • idsstring
    Filter discounts by id. If passing multiple values, must be comma separated. Non-integer values will result in a 422 error
  • limitstring
    Number of results.
    (default:50) (maximum: 250)
    Default 50Maximum 250
  • pagestringDeprecated
    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.
  • statusstring
    Returns all discounts with status enabled or disabled.
  • Get all discounts updated before a specified date.
  • Get all discounts updated after a specified date.
GET/discounts
curl 'https://api.rechargeapps.com/discounts' \
 -H 'X-Recharge-Access-Token: your_api_token' \ n -d limit=3 -G
Response
{
  "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

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-11

Query parameters

  • Returns the count of discounts created before a specified date.
  • Returns the count of discounts created after a specified date.
  • Returns the count of discounts that are of a given type. Value can be percentage, fixed_amount or shipping.
  • statusstring
    Returns the count of discounts with status of enabled or disabled.
  • Returns the count of discounts updated before a specified date.
  • Returns the count of discounts updated after a specified date.

Response attributes

GET/discounts/count
curl 'https://api.rechargeapps.com/discounts/count' \
  -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "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

  • Code of the discount you want to apply to an address.
  • Id of the discount you want to apply to an address.

Response attributes

  • idinteger
    The unique numeric identifier for the charge.
  • address_idinteger
    The customer shipping address the charge is tied to.
  • An object containing analytics data associated with the charge.
    Show child attributesHide child attributes1
  • All the billing information related to the charge.
    Show child attributesHide child attributes10
    • address1string
      Line one of the billing address.
    • address2string
      Line two of the billing address.
    • citystring
      The city of the billing address.
    • companystring
      The company name of the billing address.
    • countrystring
      The country of the billing address.
    • The first name of the billing address.
    • last_namestring
      The last name of the billing address.
    • phonestring
      The phone number of the billing address.
    • provincestring
      The name of the province or state associated with the billing address.
    • zipstring
      The zip code of the billing address.
  • Details of the access method used by the purchaser.
    Show child attributesHide child attributes2
    • The IP address of the buyer as detected in checkout.
    • The user agent detected during checkout.
  • created_atdatetime
    When the Charge was created.
  • The hash of the Customer associated with the charge.
  • The id of the Customer associated with the charge.
  • An array of discounts associated with the charge.
    Show child attributesHide child attributes4
    • The id of a discount associated with this charge.
    • codestring
      The code of the discount applied on this charge.
    • valuefloat
      The value of the discount applied to the charge.
    • typestring
      The type of the value of the discount applied to the charge (percentage, fixed_amount).
  • emailstring
    The email address of the customer.
  • The 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_namestring
    The last name of the customer.
  • line_itemsarray of objects
    A list of line_item objects, each one containing information about an item in the charge. One line_item per subscription.
    Show child attributesHide child attributes12
    • graminteger
      Weight in gram of the item.
    • imagesobject
      Weight in gram of the item.
      Show child attributesHide child attributes2
      • keystring
        The key for an image associated to the product.
        Possible values
        largemediumoriginalsmall
      • valuestring
        The value of the property
    • The original price of the item without discounts or taxes.
    • pricestring
      The price of the item.
    • propertiesarray of objects
      An array of Property object containing customer information for an item.
      Show child attributesHide child attributes2
      • namestring
        The name of the property.
      • valuestring
        The url reference for the image (CDN or other).
    • quantityinteger
      The number of products that were purchased.
    • The unique numeric identifier for the Shopify product in the fulfillment.
    • The id of the Shopify product variant.
    • skustring
      A unique identifier of the item in the fulfillment.
    • titlestring
      The title of the product.
    • The title of the product variant.
    • The id of the corresponding Subscription.
  • notestring
    Shows the next order in sequence.
  • note_attributesarray of objects
    note attributes.
    Show child attributesHide child attributes2
    • namestring
      The name for the note_attribute.
    • valuestring
      The value for the associated note_attribute.
  • The payment processor used on the charge.
  • processed_atdatetime
    The date and time when the transaction was processed.
  • scheduled_atdatetime
    When the charge processing will next be attempted.
    If a charge failed to process, scheduled_at remains the initial scheduled date of the processing not the date of the next attempt.
  • The number of successfully processed child orders on the charge.
  • The shipping address of the shipping address.
    Show child attributesHide child attributes10
    • address1string
      Line one of the billing address.
    • address2string
      Line two of the billing address.
    • citystring
      The city of the billing address.
    • companystring
      The company name of the billing address.
    • countrystring
      The country of the billing address.
    • The first name of the billing address.
    • last_namestring
      The last name of the billing address.
    • phonestring
      The phone number of the billing address.
    • provincestring
      The name of the province or state associated with the billing address.
    • zipstring
      The zip code of the billing address.
  • shipping_linesarray of objects
    An array of shipping lines associated with the charge.
    Show child attributesHide child attributes5
    • codestring
      The code associated with the shipping line of the charge.
    • pricestring
      The price of the shipping line.
    • sourcestring
      The source of the shipping line.
    • titlestring
      The title of the shipping line.
    • taxablestring
      A boolean indicating if the shipping line is taxable.
  • The unique numeric identifier within Shopify for the charge
  • statusstring
    The status of the charge.
    Possible values
    SUCCESSERRORQUEUEDSKIPPEDREFUNDEDPARTIALLY_REFUNDED
  • The item price without taxes and discounts. Use subtotal_price instead.
  • The item price without taxes and shipping.
  • tagsarray
    Array of strings used to distinguish specific charges.
  • tax_linesarray of objects
    Array of strings used to distinguish specific charges.
    Show child attributesHide child attributes5
    • codestring
      The code associated with the shipping line of the charge.
    • pricestring
      The price of the shipping line.
    • sourcestring
      The source of the shipping line.
    • titlestring
      The title of the shipping line.
    • taxablestring
      A boolean indicating if the shipping line is taxable.
  • The sum of the discounts applied to the Charge.
  • The sum of all the prices of all the items in the charge.
  • The sum of all the prices of all the items in the charge, taxes and discounts included (must be positive).
  • The sum of all refunds that were made on specific charge.
  • The sum of all refunds that were made on specific charge.
  • The unique alphanumeric identifier of the transaction.
  • typestring
    The type of the charge.
    Possible values
    CHECKOUTRECURRING
  • updated_atdatetime
    The date and time when the Charge was last updated.
  • errorstring
    Error reason as sentence text (typically returned direct from the payment processor). e.g. "Customer needs to update credit card"
  • Structured reason why the charge failed such as CUSTOMER_NEEDS_TO_UPDATE_CARD
  • The date when a charge was last attempted.
  • Shows how many times an attempt to charge was placed.
  • The date when the next attempt will be placed.
  • Indicates if Recharge was able to find the shopify_variant_id from the charge.
POST/addresses/{id}/apply_discount
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
}'
Response
{
  "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.
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.

Body parameters

  • Code of the discount you want to apply to a charge.
  • Id of the discount you want to apply to a charge.

Response attributes

  • idinteger
    Unique numeric identifier for the Address.
  • address1string
    The street associated with the Address.
  • address2string
    Any additional information associated with the shipping address.
  • cart_notestringBigCommerceCustomRCS
    The note that that will be passed to the note field of Orders made within the Address.
    cart_note is not currently honored when sent to the Shopify contract api (SCI).
  • citystring
    The city associated with the shipping address.
  • companystring
    The company associated with the shipping address.
  • countrystring
    The country associated with the shipping address.
  • The 2-letter country code.
  • Unique numeric identifier for the Customer associated with the Address.
  • Unique numeric identifier of Discount that is applied on the Address.
  • The customer’s first name associated with the address.
  • last_namestring
    The customer’s last name associated with the address.
  • note_attributesarray of objects
    Extra information that is added to the order.
    Show child attributesHide child attributes2
    • namestring
      The name for the note_attribute.
    • valuestring
      The value for the associated note_attribute.
  • phonestring
    The 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.
  • provincestring
    The state or province associated with the address.
  • shipping_lines_overridearray of objects
    Used when shipping rates need to be overridden. If this parameter has value null, rates will be fetched when a related Charge is created or regenerated
    Show child attributesHide child attributes3
    • codestring
      The code of the associated shipping line.
    • pricestring
      The price (in store’s currency) of the associated shipping line.
    • titlestring
      The title of the associated shipping line.
  • zipstring
    The zip or postal code associated with the address.
  • Additional information added to an initial order.
    Important: This field will be deprecated. Please use note_attributes instead.
  • created_atdatetime
    The date and time when the address was created.
  • Shipping line details.
    Important: This field will be deprecated. Please use shipping_lines_override instead.
  • updated_atdatetime
    The date and time when the Address was last updated.
POST/charges/{id}/apply_discount
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"
}'
Response
{
  "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

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_idinteger
    Unique numeric identifier for address from which you want to remove the discount.
  • charge_idinteger
    Unique numeric identifier of the charge from which you want to remove the discount.

Response attributes

  • idinteger
    Unique numeric identifier for the Address.
  • address1string
    The street associated with the Address.
  • address2string
    Any additional information associated with the shipping address.
  • cart_notestringBigCommerceCustomRCS
    The note that that will be passed to the note field of Orders made within the Address.
    cart_note is not currently honored when sent to the Shopify contract api (SCI).
  • citystring
    The city associated with the shipping address.
  • companystring
    The company associated with the shipping address.
  • countrystring
    The country associated with the shipping address.
  • The 2-letter country code.
  • Unique numeric identifier for the Customer associated with the Address.
  • Unique numeric identifier of Discount that is applied on the Address.
  • The customer’s first name associated with the address.
  • last_namestring
    The customer’s last name associated with the address.
  • note_attributesarray of objects
    Extra information that is added to the order.
    Show child attributesHide child attributes2
    • namestring
      The name for the note_attribute.
    • valuestring
      The value for the associated note_attribute.
  • phonestring
    The 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.
  • provincestring
    The state or province associated with the address.
  • shipping_lines_overridearray of objects
    Used when shipping rates need to be overridden. If this parameter has value null, rates will be fetched when a related Charge is created or regenerated
    Show child attributesHide child attributes3
    • codestring
      The code of the associated shipping line.
    • pricestring
      The price (in store’s currency) of the associated shipping line.
    • titlestring
      The title of the associated shipping line.
  • zipstring
    The zip or postal code associated with the address.
  • Additional information added to an initial order.
    Important: This field will be deprecated. Please use note_attributes instead.
  • created_atdatetime
    The date and time when the address was created.
  • Shipping line details.
    Important: This field will be deprecated. Please use shipping_lines_override instead.
  • updated_atdatetime
    The date and time when the Address was last updated.
POST/addresses/{id}/remove_discount
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 '{}'
Response
{
  "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"
  }
}