This article covers
Applying coupon to the customer’s first subscription when multiple subscriptions per customer are allowed
As a merchant, you might allow your customers to have multiple subscriptions. You might want to apply a coupon only to the first subscription of every new customer, but would not want coupons to be applied when an existing customer signs up for another subscription.
This article will cover the steps needed to be required to implement this workflow.
Though Chargebee does not directly have a setting to apply coupons exclusively to the first subscription of each customer, you can implement this using our APIs with some development effort at your end.
Chargebee hosted page sign-up -
If your customers self-sign up using the hosted checkout pages of Chargebee, first have a custom-built form at your end where you collect the customer’s email address.
Now use the List Customers API and pass the email address collected in the form as an input parameter to this API call. If it is an existing customer, the customer details will be returned in the response. You can now redirect the customer to the hosted page for completing the checkout.
If it is a new customer, then invoke the Checkout new subscription API and pass the plan and coupon details as input parameters to the payload of this API call. This API returns a hosted page URL to which the customer should be redirected. This hosted page will have the coupon automatically applied and the customer can complete the checkout process with a discount.
API-based integration -
If you are using an API-based integration, then you can use the same List customers API mentioned above to check if it is a new/existing customer.
In case, of a new customer, you can invoke the Create subscription API and pass the plan and coupon details as an input to the payload. In case, of an existing customer, then use the same API to create the subscription without passing any coupon details to the API payload.
Note: If you are on PC 2.0, you’d have to ensure that the customer record is first created before creating the subscription. It is not possible to directly create the customer and subscription records simultaneously in PC 2.0