Applying A Discount With A Recurring Application Charge API

vanessa_adabra
Shopify Partner
11 0 0

Hi, 

 

I have been reading this documentation: https://shopify.dev/apps/billing/purchase-adjustments/subscription-discounts#create-a-new-recurring-... and I have been trying to apply it to my cUrl request. Unfortunately, I am unable to produce a payment request that takes the discount into consideration.

Here is my cUrl without the sensitive data:

curl --location --request POST 'https:///admin/api/2021-10/recurring_application_charges.json' \
--header 'X-Shopify-Access-Token:' \
--header 'Content-Type: application/json' \
--header 'Cookie: _master_udr=' \
--data-raw '{

    "recurring_application_charge": {
        "name": "Super Duper Plan",
        "price": 5,
        "currency": "EUR",
        "interval": "ANNUAL",
        "return_url": "https://shopify.dev/apps/billing/purchase-adjustments/subscription-discounts",
        "test": true,
        "discount": {
            "value": {
                "amount": {"amount": 1.00,"currency": "EUR"}
            }
        },
        "priceAfterDiscount": {
            "amount": 1.00,
            "currencyCode": "EUR"
        }
    }
}'

I cannot seem to figure out how to make it work with the discount part, without it works just fine.

Reply 1 (1)

codysimi
Shopify Partner
1 0 0

It seem to be that Rest API is not supporting discount for subscription, you'd need to use GraphQl instead.