How Can I purchase multiple subscriptions by using just one button?
tbillen89
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Aug-17-2022
07:23 AM
Hi guys,
I want to create two subscription with two plan_id (I tested it with one successfully). How do I have to change my code so that two subscription can start?
let plan_id = ['P-87175610EX683864NML6XXXX', 'P-6NT18915PW169903AML6XXXX'];
// Render the PayPal button into #paypal-button-container
paypal.Buttons({
// Set up the transaction
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': plan_id[0]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
console.log("approve");
console.log(data);
console.log(actions);
let js = {
subscriptionID: data.subscriptionID,
orderID: data.orderID,
facilitatorAccessToken: data.facilitatorAccessToken,
plan_id: plan_id
}
console.log(js);
},
Labels:
- Labels:
-
PayPal Here SDK
-
REST SDK
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- can we assign a unique detail to every subscription creation? in NVP/SOAP APIs
- Recurring payments for cart with multiple individually subscribable items? in PayPal Payments Standard
- I Have PayPal API Billing Authentication Failure Python-Flask in REST APIs
- Need Help Upgrading to PayPal complete payments in PayPal Upgrade Community
- Sites.google.com subscription payment buttons not responding in PayPal Payments Standard