Handling Recurring Payments
Important: This integration method is deprecated as of January 1, 2017. PayPal continues to support existing merchants using this method, but please be advised new features and enhancements will not be applied to these integrations. For new integrations, see the PayPal Subscriptions Integration Guide.
Set up a recurring payment to handle subscription and other payments that occur on a fixed schedule.
How Recurring Payments Work
Permission to allow recurring payments is established by the buyer setting up a billing agreement with the merchant on PayPal. For Express Checkout, the billing agreement can be established either in advance or when the buyer first makes a purchase; in either case, it occurs when you call Express Checkout API operations.
When you support recurring payments for a buyer, you create a recurring payments profile. The profile contains information about the recurring payments, including details for an optional trial period and a regular payment period. Both periods contain information about the payment frequency and payment amounts, including shipping and tax, if applicable.
After creating a profile, PayPal automatically queues payments based on the billing start date, billing frequency, and billing amount. Payments reoccur until the profile expires, there are too many failed payments to continue, or you cancel the profile.
Note: When the buyer uses Express Checkout, they can also cancel a recurring payments profile.
PayPal funds queued payments using the normal payment method hierarchy within the buyer's PayPal account.
After creating a recurring payments profile, you can view profile details or cancel the profile from your PayPal account. You can also access recurring payments reports from the PayPal Business Overview page.
Also, after creating a recurring payments profile, you can use the Recurring Payments API to do the following:
- Get information details about a recurring payments profile.
- Change the status of a recurring payments profile.
- Update the details of the recurring payments profile.
- Bill the outstanding amount of the recurring payments profile.
The current release of the Recurring Payments API has the following limitations:
- A profile can have, at most, one optional trial period and a single regular payment period.
- The profile start date may not be earlier than the profile creation date.
Recurring Payments with Express Checkout also has the following limitations:
- A buyer's PayPal account must include an active credit card. If not, you cannot create a recurring payments profile for the buyer.
- Recurring payments cannot be created for buyers in China. In this case, you can use reference transactions as an alternate solution.
- You can create one recurring payments profile during checkout.
- You can increase the profile amount by only 20% in each 180-day interval after you create the profile.
Recurring Payments Terms
This table lists and describes terms that are commonly used in the context of PayPal recurring payments.
|Recurring payments profile||Your record of a recurring transaction for a single buyer. The profile includes all information required to automatically bill the buyer a fixed amount of money at a fixed interval.|
|Billing cycle||Make one payment per billing cycle. Each billing cycle has two components:
|Regular payment period||The main subscription period for this profile, which defines a payment amount for each billing cycle. The regular payment period begins after the trial period, if you specify a trial period for the profile.|
|Trial period||An optional subscription period before the regular payment period begins. A trial period cannot have the same billing cycles and payment amounts as the regular payment period.|
|Payment amount||The amount the buyer pays for each billing cycle.|
|Outstanding balance||If a payment fails for any reason, PayPal adds that amount to the profile's outstanding balance.|
|Profile ID||An alphanumeric string (generated by PayPal) that uniquely identifies a recurring profile. You can specify the Profile ID in the `TransactionSearch` API operation to obtain all payments associated with the identified profile.|
Recurring Payments Profile Options
You can create a recurring payments profile that allows a regular payment period, an optional trial period, an initial payment, and other options.
Specify the Regular Payment Period
Each recurring payments profile has a regular payment period that defines the amount and frequency of the payment. This table lists the required fields for specifying the regular payment period.
||The date when billing for this profile begins. Note: The profile may take up to 24 hours for activation.|
||The unit of measure for the billing cycle. Must be one of the following:
||The number of billing periods that make up one billing cycle. The combination of billing frequency and billing period must be less than or equal to one year. Note: If the billing period is
||Amount to bill for each billing cycle.|
You can optionally include a value for
TOTALBILLINGCYCLES (SOAP field
ScheduleDetails.PaymentPeriod.TotalBillingCycles), which specifies the total number of billing cycles in the regular payment period. If you either do not specify a value or specify the value
0, the payments continue until PayPal (or the buyer) cancels or suspends the profile. If the value is greater than
0, the regular payment period continues for the specified number of billing cycles. You can also specify an optional shipping amount or tax amount for the regular payment period.
Include an Optional Trial Period
You can optionally include a trial period in the profile by specifying the following fields in the
CreateRecurringPaymentsProfile request. This table lists the required fields for creating an optional trial period.
Specify an Initial Payment
You can optionally specify an initial non-recurring payment when the recurring payments profile is created by including the following fields in the
By default, PayPal does not activate the profile if the initial payment amount fails. To override this default behavior, set the
FAILEDINITAMTACTION field to
ContinueOnFailure. If the initial payment amount fails,
ContinueOnFailure instructs PayPal to add the failed payment amount to the outstanding balance due on this recurring payment profile.
If you do not set
FAILEDINITAMTACTION or set it to
CancelOnFailure, PayPal creates the recurring payment profile. However, PayPal places the profile into a pending status until the initial payment completes. If the initial payment clears, PayPal notifies you by Instant Payment Notification (IPN) that it has activated the pending profile. If the payment fails, PayPal notifies you by IPN that it has canceled the pending profile. If you used Express Checkout to create the profile, the buyer receives an email stating that PayPal cleared the initial payment or canceled the pending profile.
Maximum Number of Failed Payments
By including the
MAXFAILEDPAYMENTS field in the
CreateRecurringPaymentsProfile request, you set the number of failed payments allowed before PayPal automatically suspends the profile. PayPal sends you an IPN message when the number of failed payments reaches the maximum number specified.
Bill the Outstanding Amount
If a payment fails for any reason, PayPal adds the billing amount (including shipping and tax, if applicable) to the profile's outstanding balance. Use the
AUTOBILLOUTAMT field in the
CreateRecurringPaymentsProfile request to specify whether PayPal should add the outstanding amount to the payment amount for the next billing cycle. Whether or not you choose to include the outstanding amount with the payment for the next billing cycle, you can also use the
BillOutstandingAmount API to collect that amount at any time.
Identify Items as Digital or Physical Goods
Set all the payment details item fields in this table in the
CreateRecurringPaymentsProfile request. If all items are digital goods, be sure to set the item category field to
Digital to get the discount rate for digital goods.
||For digital goods, this field must be set to
||Cost of item.|
Recurring Payments with the Express Checkout API
During the checkout flow, you can create a recurring payment with or without other purchases.
The following diagram illustrates the typical processing flow to create recurring payments during checkout.
The circled numbers in the diagram correspond to the numbered steps in this table:
|2||Returns a token, which identifies the transaction, to the merchant.|
|3||Redirects buyer's browser to:
|Displays login page and allows buyer to select payment options and shipping address.|
|4||Redirects buyer's browser to
|Displays merchant review page for buyer.|
|7||Displays successful transaction page.|
Initiate the Processing Flow With SetExpressCheckout
As in the Express Checkout flow, the
SetExpressCheckout request notifies PayPal that you are:
- Initiating an order that can be either a one-time purchase, a recurring payment, or a mixture of a one-time purchase and a recurring payment
- Initiating the processing flow to create a billing agreement for a recurring payment with no associated one-time purchase or recurring payment
Note: You can also initiate the processing flow using
SetCustomerBillingAgreementfor orders that contain a recurring payment.
Typically, you set the amount of the payment for an Express Checkout transaction when you call the
SetExpressCheckout request. You confirm the amount in the
DoExpressCheckoutPayment request. If, however, you set the amount of the payment to
0 in the
SetExpressCheckout request, you can create a billing agreement without initiating a payment.
Note: To create a billing agreement without purchase, use Version 54.0 or higher, of the PayPal API.
To set up a billing agreement for a recurring payment, modify the
SetExpressCheckout request as follows:
- Add an
L_BILLINGTYPEn field for the billing agreement you want to create. You can only create one billing agreement at a time. The n formatting is retained for backwards compatibility and can now only be
0. Set the value of the
L_BILLINGTYPEn field to
- Add an
L_BILLINGAGREEMENTDESCRIPTIONn field to correspond to the
L_BILLINGTYPEn field you pass. The n formatting is retained for backwards compatibility and can now only be
0. Set the value of the field to the description of the goods or services associated with that billing agreement, for example:
L_BILLINGAGREEMENTDESCRIPTION0=Time Magazine subscription
- If there is no associated purchase, set
- (Optional) Set
MAXAMTto the average expected transaction amount. PayPal uses the value you pass to validate the buyer's payment method for recurring payments. If you do not specify a value, the default is 25.00.
SetExpressCheckout response provides a token that uniquely identifies the transaction for subsequent redirects and API calls.
Redirect the Buyer to PayPal
After you receive a successful response from
SetExpressCheckout, add the
TOKEN from the
SetExpressCheckout response as a name/value pair to the following URL, and redirect your buyer to it:
When redirecting the buyer to PayPal, PayPal recommends that you use the HTTPS response 302 "Object Moved" with the URL as the value of the
Location header in the HTTPS response. Make sure that you use an SSL/TLS-enabled server to prevent browser warnings about a mix of secure and insecure graphics.
Get Buyer Details by Using GetExpressCheckoutDetails
GetExpressCheckoutDetails method returns information about the buyer, including name and email address stored on PayPal. You can optionally call this API after PayPal redirects the buyer's browser to the
ReturnURL you specified in the
SetExpressCheckout request. The
GetExpressCheckoutDetails request has one required parameter,
TOKEN, which is the value returned in the
SetExpressCheckout response. PayPal does not return the values you specified for the following parameter fields in the
GetExpressCheckoutDetails response unless the transaction includes a purchase. PayPal ignores the fields if you set up a billing agreement for a recurring payment that is not immediately charged.
Create Profiles with CreateRecurringPaymentsProfile
After your buyer has agreed to the recurring payments billing agreement on your confirmation page, you must call
CreateRecurringPaymentsProfile to create the profile. If the transaction contains a one-time purchase, call
DoExpressCheckoutPayment to complete that purchase. Then, call
CreateRecurringPaymentsProfile for the profile you plan to create. To create multiple recurring payments profiles, you must call
SetExpressCheckout to get the buyer's approval and then call
CreateRecurringPaymentsProfile for each recurring payment profile.
Important: PayPal does not create the recurring payments profile until you receive a success response from the
To obtain the best rates for digital goods, set values for the following required payment details item fields:
L_PAYMENTREQUEST_0_ITEMCATEGORYn(you must set the value to
Note: The payment details item fields are available with version 69.0 and later of the
CreateRecurringPaymentsProfile response contains a Profile ID, which is an encoded string that uniquely identifies the recurring payments profile. The following is a
CreateRecurringPaymentsProfile example that enables you to obtain the best rates for digital goods items.
[requiredSecurityParameters] &METHOD=CreateRecurringPaymentsProfile TOKEN=EC-13W99099UU817504D &PROFILESTARTDATE:20XX-03-05T03:00:00 &DESC=Movie clips &BILLINGPERIOD=Month &BILLINGFREQUENCY=12 &AMT=1.00 &CURRENCYCODE=USD &EMAILfirstname.lastname@example.org &L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital &L_PAYMENTREQUEST_0_NAME0=Kitty Antics &L_PAYMENTREQUEST_0_AMT0=1.00 &L_PAYMENTREQUEST_0_QTY0=1
[successResponseFields] &PROFILEID=I-G7ALAX8095JY &PROFILESTATUS=Active
Recurring Payments Profile Status
The recurring payments actions you may take depend on the status of the profile.
A recurring payments profile can have one of the following status values:
If PayPal successfully creates the profile, the profile has an
ActiveProfile status. However, if a non-recurring initial payment fails and you set
CancelOnFailure in the
CreateRecurringPaymentsProfile request, PayPal creates the profile with a status of
PendingProfile. The profile remains in this status until the initial payment either completes successfully or fails.
A profile has a status of
ExpiredProfile when PayPal completes the total billing cycles for the optional trial and the regular payment periods.
You can suspend or cancel a profile by using the
ManageRecurringPaymentsProfileStatus API. You can also reactivate a suspended profile. If PayPal has already reached the maximum number of failed payments, however, you must increase the number of failed payments before reactivating the profile.
Note: You can also suspend, cancel, or reactive a recurring payments profile through the PayPal website.
For recurring payments profiles created with the Express Checkout API, the buyer receives an email about the change in status of their recurring payment.
Get Recurring Payments Profile Information
GetRecurringPaymentsProfileDetails API to obtain information about a profile.
Note: You can also get information about recurring payments profiles from the PayPal website.
Along with the information that you specified in the
GetRecurringPaymentsProfileDetails also returns the following summary information about the profile:
- Profile status
- Next scheduled billing date
- Number of billing cycles completed in the active subscription period
- Number of billing cycles remaining in the active subscription period
- Current outstanding balance
- Total number of failed billing cycles
- Date of the last successful payment received
- Amount of the last successful payment received
Modify a Recurring Payments Profile
UpdateRecurringPaymentsProfile API to modify a recurring payments profile.
Note: You can also modify recurring payments profiles from the PayPal website.
You can modify only the following specific information about an active or suspended profile:
- Subscriber name or address
- Past due or outstanding amount
- Whether to bill the outstanding amount with the next billing cycle
- Maximum number of failed payments allowed
- Profile description and reference
- Number of additional billing cycles
- Billing amount, tax amount, or shipping amount
Note: You cannot modify the billing frequency or billing period of a profile. You can modify the number of billing cycles in the profile.
You can modify the following profile information during the trial period or regular payment period.
- Billing amount
- Number of billing cycles
Note: For recurring payments with the Express Checkout API, PayPal does not allow certain updates, such as billing amount, within 3 days of the scheduled billing date.
The profile changes take effect with the next payment after the call to update the profile. Say, for example, the buyer has made 1 trial payment out of a total of 3. You call
UpdateRecurringPaymentsProfile to increase the number of billing cycles to 5. This provides the buyer with 4 additional trial payments. If you call
UpdateRecurringPaymentsProfile during the regular payment period, the changes take effect with the buyer's next scheduled regular payment.
For complete details, see the Express Checkout API Reference.
When you update the subscriber shipping address, you must enter all of address fields, not just those that are changing:
To update the subscriber's street address, for example, specify all the address fields listed in the Name-Value Pair Developer Guide and Reference or SOAP API Reference. Do not specify only the street address field.
Update the Billing Amount
For Express Checkout-created profiles, you can increase the recurring payment total amount by 20% maximum in a fixed 180-day interval after profile creation. The 20% maximum is based on the total amount of the profile at the beginning of the 180-day interval, including any shipping or tax amount. If, for example, you create a profile on March 10 with a total amount of $100, during the 180-day interval from March 10 to September 6, you can increase the amount to a maximum of $120 (120% of $100). Suppose that during the first 180-day interval, you increased the payment amount to $110. During the next 180-day interval (starting September 7), you can only increase the amount of the payment to a maximum of $132 (120% of $110).
Bill the Outstanding Amount of Profile
BillOutstandingAmount API to immediately bill the buyer for the current past due or outstanding amount for a recurring payments profile.
Note: You can also bill the buyer for the current past due or outstanding amount for a recurring payments profile from the PayPal website.
To bill the outstanding amount:
The profile status must be active or suspended.
BillOutstandingAmountAPI does not reactivate a suspended profile. You need to call
ManageRecurringProfileStatusto do this.
- The profile must have a non-zero outstanding balance.
- The amount of the payment cannot exceed the outstanding amount for the profile.
BillOutstandingAmountcall cannot be within 24 hours of a regularly scheduled payment for this profile.
Note: An error occurs when another outstanding balance payment is already queued.
PayPal informs you by IPN about the success or failure of the outstanding payment. For Express Checkout-created profiles, the buyer receives an email notification of the payment.
Recurring Payments Notifications
PayPal notifies you of recurring payments events through IPN and email. Typically, however, you can call
GetTransactionDetails to obtain the information you need.
PayPal notifies you of certain events through IPN. For Express Checkout-created recurring payments profiles, PayPal also notifies buyers of specific events by email. The following table indicates when PayPal generates IPN and emails:
|Profile successfully created||Yes||Yes|
|Profile creation failed||Yes||Yes|
|Profile canceled from paypal.com interface||Yes||Yes|
|Profile status changed using API||No||Yes|
|Profile updated using API||No||Yes|
|Initial payment either succeeded or failed||Yes||Yes|
|Payment either succeeded or failed (during either trial period or regular payment period)||Yes||Yes|
|Outstanding payment either succeeded or failed||Yes||Yes|
|Maximum number of failed payments reached||Yes||No|
Note: API transactions such as
ManangeRecurringPaymentsProfileStatusdo not trigger IPN notification. The API response immediately provides the success or failure of the call.