I already have an implemented CMS system where the user creates the subscription plans.
I want to integrate my CMS server with Paypal so when the user creates a plan it will be created on Paypal servers.
I can see how to do that in https://developer.paypal.com/docs/subscriptions/integrate/
But the problem is there is no documentation for the front-end side for the subscription step ! How should i redirect the customer to Paypal to login, and how will i receive the data to send it to my server ?
Note : Since i want my user to create plans only on my CMS, there is no easier way to integrate with paypal than this : https://developer.paypal.com/docs/subscriptions/integrate/ .. right? i don't want to use Smart Buttons so the only option i have is to integrate with APIs.. if there is any easier way please tell me.
This is a bit hidden.
When you create a subscription, its status will be set to APPROVAL_PENDING
. Look for the "rel": "approve"
link in the response (in links
). The URL will look something like this:
https://www.paypal.com/webapps/billing/subscriptions?ba_token=xyz
This is the URL you need to redirect the customer's browser to. Once they click on "Subscribe" to approve it, PayPal will redirect their browser to the return_url
value you set when you created the subscription.
PayPal adds 3 extra parameters to that return URL: subscription_id
(self-explanatory), ba_token
(the approval token), and token
(???). At that point, you can get the subscription details from PayPal, and its status should now be "ACTIVE".
Now I just need to figure out why next_billing_time
is set in the past, and why I'm not receiving the PAYMENT_SALE webhooks :)
Hope this answers your question.