I have some questions about subscription functionality using REST API. We have implemented recurring payments using "Express Checkout NVP/SOAP Integration" but for us it isn't optimal, because:
- Webhooks easier and more usable then IPN messages;
- We can't force customers to pay from PayPal balance.
That's why I want to rewrite it with REST API. I think the flow will be like:
- User press button and we make the first request to get auth token;
- Create billing plan;
- Activate billing plan;
- Create billing agreement;
- Because of we're using PayPal payments here we redirect the customer to approve payment;
- Execute billing agreement.
My questions are:
- Is this flow correct?
- To redirect customer for approving payment we need to make four requests to PayPal API servers, is it normal?
- Should I create and activate a billing plan for every customer or I can use one plan for all customers?
- If so can I create the plan in the merchant's profile page or I can do it only programmatically?
Let me see if I can answer your questions and provide some samples.
- Yes, that flow is correct for the first request. If you already have a plan that you'd like to subscribe people to created, you can skip those billing plan steps. More on that below.
- For the REST APIs, yes that's the normal flow for PayPal. Think of the plan as setting up the architecture of the payment that you'd like to offer (such as a subscription plan for a service). You set this up once and then can subscribe many people to that same subscription plan using a billing agreement.
- If the details of the plan are the same for each person, then create one plan and then use a billing agreement for each person to subscribe them all to that same plan.
- I haven't seen an integration of this with the profile system, but it's an interesting idea. For the time being, as far as I know you'll need to do this programmatically.
I've also created some new quickstart guides on the site that should help through creating the billing plan and agreements:
- Billing plans: https://developer.paypal.com/docs/api/quickstart/create-billing-plan/
- Billing agreements: https://developer.paypal.com/docs/api/quickstart/create-billing-agreement/
I have a more practical example of this billing plan / agreement integration in a Slack bot payment sample, if that helps: https://developer.paypal.com/docs/api/service-integrations/slack-bot/subscribe/