At the moment I have a relatively simple PayPal checkout that captures one-time payments using the PayPal Payments API.
As part of this, there is the option for the user to enter a voucher code and receive a discount on their order. I can do this by submitting a POST request with something like:
request_body['purchase_units'][0]['amount'] = {
'currency_code': 'GBP',
'value': str(payment_amount),
'breakdown': {
'item_total': {
'currency_code': 'GBP',
'value': str(membership_type.price)
},
'discount': {
'currency_code': 'GBP',
'value': str(discount)
}
}
}
The purchase is a semi-regular one for customers, so I am in the process of updating the checkout to move towards a subscription based system, where the user is billed automatically at a set interval, rather than manually having to go through the checkout every time as currently.
I am using the paypal Subscriptions API and have set up the Products and Plans, but I cannot see any way to offer any one-time discount when signing up to a subscription. I can see the option for a free trial, but no way to offer fine-grained control on a subscription-by-subscription basis using the API.
What I want to find out is:
In general, what is the best way of tackling regular PayPal payments, whilst being able to offer some kind of discount in particular instances?
To my knowledge: