Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some questions about billing plans & agreements REST API

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:

  1. Is this flow correct?
  2. To redirect customer for approving payment we need to make four requests to PayPal API servers, is it normal?
  3. Should I create and activate a billing plan for every customer or I can use one plan for all customers?
  4. If so can I create the plan in the merchant's profile page or I can do it only programmatically?
like image 271
greg Avatar asked Dec 19 '22 10:12

greg


1 Answers

Let me see if I can answer your questions and provide some samples.

  1. 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.
  2. 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.
  3. 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.
  4. 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/

like image 171
Jonathan LeBlanc Avatar answered Feb 12 '23 01:02

Jonathan LeBlanc