• Payments and Transfers
  • Disputes and Limitations
  • My Account
  • My Wallet
  • Login & Security
  • Seller Tools

How do I integrate the PayPal REST API for Recurring Payments?

Here's how:
  1. Create a billing plan.
  2. Activate the billing plan.
  3. Create a billing agreement.
  4. Execute the billing agreement.
Use cURL to set up these plans. Before you begin, check your REST API apps settings to make sure your REST API apps subscriptions are turned on.

Create a billing plan

The following example shows how to define parameters for your billing plan:
curl -k -v -H 
-H “Authorization: Bearer ACCESS_TOKEN” 
-d '{“name”:”Test REST Club Plan”,
“description”:”Template creation.”,
“payment_definitions”:[{“name”:”Regular Payments”,
“max_fail_attempts”:”0”}}' https://api.sandbox.paypal.com/v1/payments/billing-plans 

PayPal returns a Billing Plan ID starting with “P-”.

Activate the billing plan

Next, use these commands to activate the billing plan:
curl -k -v -H 
-H “Authorization: Bearer ACCESS_TOKEN” 
-d '[{“path”:”/”,
“op”:”replace”}]' https://api.sandbox.paypal.com/v1/payments/billing-plans/

Create a billing agreement

Now, define parameters for your billing agreement, as shown here:
curl -k -v -H 
-H “Authorization: Bearer ACCESS_TOKEN” 
-d '{“name”:”Test REST Club Plan”,
“description”:”Template creation.”,
“shipping_address”:{“line1”:”111 First Street”,
“country_code”:”US”}}' https://api.sandbox.paypal.com/v1/payments/billing-agreements

PayPal returns an Express Checkout redirect URL with an EC token, similar to this one:


You’ll need to redirect your customer to PayPal via the returned URL. Once the billing agreement is authorized, the customer is redirected to your site, which is the return_url you set under Create billing plan.

Execute the billing agreement

The following commands activate the billing agreement:
curl -k -v -H 
-H “Authorization: Bearer ACCESS_TOKEN” 
-d '{}' https://api.sandbox.paypal.com/v1/payments/billing-agreements/EC-TOKEN_HERE/agreement-execute
Was this article helpful?
Need help in integrating Paypal API (1089 views)

More ways we can help

Resolution Center
Fix transaction and account related issues
Community Forum
Join the discussion with PayPal customers
Tax center
Get your 1099-K and other tax info here
Business Help
Get help with using any of our PayPal products
Technical Help
Find out how PayPal works for your business
Contact Us
Contact customer service
Message Center
Send, receive, and view your PayPal messages
How are we doing?
Take our survey