My project runs on products with both the one time and recurring payments.
Right now I'm trying to integrate the paypal smart buttons, which would create one transaction consisting of one time and recurring payments.
For example: The user adds to the cart Product1 (5$ one time payment) and Product2 (15$ recurring payment), which makes it a 20$ transaction.
Is it possible to charge the user 20$ in the beginning and set a trial on the recurring product (Product2 in our case), which would charge the user from the next billing period?
Here's what I tried:
On the js side I have the following code
createPayPalButton = function() {
// setting up the details for the transaction
createOrder: function (data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '20.00'
}
}]
})
},
// setting up the details for subscription
createSubscription: function (data, actions) {
return actions.subscription.create({
'plan_id': 'MY_PLAN_ID'
});
},
}
$(function() {
createPayPalButton();
})
But after running it I receive the following error: Uncaught Error: Do not pass both createSubscription and createOrder
I tried to find a solution on the paypal side, but I didn't manage to.
Any guidance would be much appreciated. Thank you.