View as Markdown
API Spec (JSON)
API Spec (YAML)
Compact modeHides field descriptions and other prose for a more compact, scannable view of the API reference.Client CredentialsToken URLhttps://api-m.sandbox.paypal.com/v1/oauth2/tokenInheaderScopes
https://uri.paypal.com/services/subscriptionsapplication/json
TypeScript Definitions
Use the request body type in TypeScript.
typeenumRequiredFIXED. The plan has a fixed number of payment cycles.INFINITE. The plan has infinite, or 0, payment cycles.payment_definitionsobject<payment_definition>[]Optionalcharge_modelsobject<charge_models>[]Optionalamountobject<currency>RequiredvaluestringRequiredamountobject<currency>RequiredvaluestringRequiredmerchant_preferencesobject<merchant_preferences>Optionalauto_bill_amountenumOptionalNO. PayPal does not automatically bill the customer the outstanding balance.YES. PayPal automatically bills the customer the outstanding balance.initial_fail_amount_actionenumOptionalCONTINUE. The agreement remains active and the failed payment amount is added to the outstanding balance. If auto-billing is enabled, PayPal automatically bills the outstanding balance in the next billing cycle.CANCEL PayPal creates the agreement but sets its state to pending until the initial payment clears. If the initial payment clears, the pending agreement becomes active. If the initial payment fails, the pending agreement is canceled.Note: You can use the `setup_fee` value as the initial amount to trigger the `initial_fail_amount_action`.
setup_feeobject<currency>OptionalvaluestringRequiredapplication/json
application/json
curl -X POST "https://example.com/billing-plans" \ -H "Content-Type: application/json" \ -d '{ "name": "Simple Plan", "description": "Plan with one regular payment definition, minimal merchant preferences, and no shipping fees or tax.", "type": "FIXED", "payment_definitions": [ { "name": "Regular payment definition", "type": "REGULAR", "frequency": "MONTH", "frequency_interval": "2", "amount": { "value": "100", "currency": "USD" }, "cycles": "12" } ], "merchant_preferences": { "return_url": "https://example.com", "cancel_url": "https://example.com/cancel" } }'{ "id": "string", "name": "string", "description": "string", "type": "FIXED", "state": "CREATED", "create_time": "string", "update_time": "string", "payment_definitions": [ { "id": "string", "name": "string", "type": "TRIAL", "frequency_interval": "string", "frequency": "WEEK", "cycles": "string", "charge_models": [ { "id": "string", "type": "TAX", "amount": { "currency": "string", "value": "string" } } ], "amount": { "currency": "string", "value": "string" } } ], "terms": [ { "id": "string", "type": "MONTHLY", "occurrences": "string", "buyer_editable": "string", "max_billing_amount": { "currency": "string", "value": "string" }, "amount_range": { "currency": "string", "value": "string" } } ], "merchant_preferences": { "cancel_url": "http://example.com", "return_url": "http://example.com", "notify_url": "http://example.com", "max_fail_attempts": "0", "auto_bill_amount": "YES", "initial_fail_amount_action": "CONTINUE", "accepted_payment_type": "string", "char_set": "string", "setup_fee": { "currency": "string", "value": "string" } }, "links": [ { "href": "string", "rel": "string", "method": "GET" } ]}