Ali
Ali

Reputation: 155

PayPal Subscriptions: Adjustings value for a discount

How can I give discount on Subsciptions?

I have integrated PayPal API for subscriptions to my website and its working well. Please guide me how to provide discount feature for subscriptions in PayPal. For example, my subscription is 2 USD/Month with a setup fee of 100USD, now I want to offer 50 percent discount on setup fee..

Right now for the time being I have created multiple plans with different rates according to the discount I want to give and then user puts the voucher code of my website and my server redirects it to the relevant plan ID. But I am looking for a better solution.

Here is an image of a JS SDK Subscribe button:

scenerio

What I doing for this is I am destroying the whole instance and creating it again after voucher entry, but I would like to update its values dynamically.

Upvotes: 1

Views: 435

Answers (1)

Preston PHX
Preston PHX

Reputation: 30477

You need to provide a Plan object that describes the amount(s) you want to charge. This is how subscriptions work.

When creating a subscription, in addition to specifying a Plan ID, you can also additionally provide a Plan object with values to override. See the documentation for the create subscription request body, which has a plan key name.

So to make this concrete, for your case when creating the subscription plan.payment_preferences.setup_fee could contain an adjusted value.

Upvotes: 1

Related Questions