PayPal Subscriptions APIs Integration
AssafMalki
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Mar-20-2019
05:00 AM
Hey,
I try to integrate the Subscriptions API to my website.
First of all, I'm not sure if I should use this API or the billing agreement API, all I want is to bill my costumers with a fix amount each month...
Anyway,
I have created a product, a plan and a subscription,
At the end I got an id (I-2PR5ANJT6J4C)
I try to use this id in the PayPal button:
<script src="https://www.paypal.com/sdk/js?client-id=sb¤cy=ILS"></script> <script>paypal.Buttons({ style: { shape: 'pill' }, env: 'sandbox', // Or 'production' // Set up the payment: // 1. Add a payment callback createOrder: function(data, actions) { // 2. Make a request to your server return new Promise(function(resolve) { return resolve('I-2PR5ANJT6J4C'); }) }, // Execute the payment: // 1. Add an onAuthorize callback onAuthorize: function(data, actions) { // 2. Make a request to your server return actions.request.post('/my-api/execute-payment/', { paymentID: data.paymentID, payerID: data.payerID }) .then(function(res) { // 3. Show the buyer a confirmation message. }); } }).render('#paypal-button-container');</script>
And I got this error:
Uncaught Error: I-2PR5ANJT6J4C does not match pattern for order-id, ec-token or cart-id
Anyone else faced this issue? How can I pass the subscription id to the button to work correctly?
Thanks,
Assaf
Labels:
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
- I want to implement subscription functionality. in REST APIs
- How can I integrate PayPal to enable direct tipping features between users on a content platform? in REST APIs
- Need help to integrate PayPal Checkout with Ecwid in PayPal Upgrade Community
- Mandatory Account Creation Hindering Customer Experience in REST APIs
- Webhook notifications are not being sent to my server in REST APIs