REST APIs
    Get Started with PayPal REST APIs
    Authentication
    Postman Guide
    API requests
    API responses
    Core Resources
    Overview
    API Integration
      Orders API
        Orders API Use Cases
          PayPal Checkout
          Expanded Checkout
          Save Payment Methods
          Billing Agreements
          Alternative Payment Methods
          Other Use Cases
        Common Errors
        Troubleshooting
    Release Notes
    Add Tracking
    Catalog Products
    Disputes
    Identity
    Invoicing
    Orders
    Partner Referrals
    Payment Experience
    Payment Method Tokens
    Payments
    Payouts
    Referenced Payouts
    Subscriptions
    Transaction Search
    Webhooks Management
    Webhooks
    Overview
    Webhook event names
    Webhooks Events dashboard
    Webhooks simulator
    Integration
    Sandbox
    Overview
    Accounts
    Bulk Accounts
    Card testing
    Codespaces
    PayPal for Visual Studio Code
    Negative Testing
    Go Live
    Production Environment
    PayPal Application Guidelines
    PayPal Security Guidelines
    Rate Limiting Guidelines
    Idempotency
    Troubleshooting
    Not authorized
    Resource not found
    Unprocessable entity
    Validation error
    Reference
    Currency Codes
    Country Codes
    State & Province Codes
    Locale codes
    Deprecated Resources
    Deprecated resources
    Billing Agreements
    Billing Plans
    Invoicing v1
    Orders v1
    Partner Referrals v1
    Payments v1

Billing agreements

Billing agreements enables buyers to use a saved payment token to pay for an order, like save payment methods. You can use an existing billing agreement ID to complete a payment. The billing agreements flow is similar to save payment methods. Pass a billing agreement ID to pay for your order.

Billing agreements

Save payment methods with billing agreement

Save payment methods with billing agreement

Example: Billing Agreements

Use the Billing agreement ID to create the order.

Step 1: Create order

Intent = CAPTURE/AUTHORIZE

Request

Copy
Copied
{
    "intent": "CAPTURE",
    "purchase_units": [
        {
            "reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
            "amount": {
                "currency_code": "USD",
                "value": "100.00"
            }
        }
    ]
}

Step 2: Capture order using a billing agreement

Request

Copy
Copied
{
   "payment_source": {
        "token": {
            "id": "{{subscription_id}}",
            "type": "BILLING_AGREEMENT"
        }
    }
}

Response

Copy
Copied
{
    "id": "89R50479BK464364E",
    "intent": "CAPTURE",
    "status": "COMPLETED",
    "payment_source": {
        "paypal": {
            "email_address": "[email protected]",
            "account_id": "XBPP8VESHUHDS",
            "account_status": "UNVERIFIED",
            "name": {
                "given_name": "John",
                "surname": "Doe"
            },
            "address": {
                "country_code": "US"
            }
        }
    },
    "purchase_units": [
        {
            "reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
            "amount": {
                "currency_code": "USD",
                "value": "100.00"
            },
            "payee": {
                "email_address": "[email protected]",
                "merchant_id": "CME27DCHYSLEL"
            },
            "soft_descriptor": "PAYPAL *TEST STORE",
            "payments": {
                "captures": [
                    {
                        "id": "0PJ401754G9313947",
                        "status": "COMPLETED",
                        "amount": {
                            "currency_code": "USD",
                            "value": "100.00"
                        },
                        "final_capture": true,
                        "seller_protection": {
                            "status": "ELIGIBLE",
                            "dispute_categories": [
                                "ITEM_NOT_RECEIVED",
                                "UNAUTHORIZED_TRANSACTION"
                            ]
                        },
                        "seller_receivable_breakdown": {
                            "gross_amount": {
                                "currency_code": "USD",
                                "value": "100.00"
                            },
                            "paypal_fee": {
                                "currency_code": "USD",
                                "value": "3.98"
                            },
                            "net_amount": {
                                "currency_code": "USD",
                                "value": "96.02"
                            }
                        },
                        "links": [
                            {
                                "href": "https://api-m.sandbox.paypal.com/v2/payments/captures/0PJ401754G9313947",
                                "rel": "self",
                                "method": "GET"
                            },
                            {
                                "href": "https://api-m.sandbox.paypal.com/v2/payments/captures/0PJ401754G9313947/refund",
                                "rel": "refund",
                                "method": "POST"
                            },
                            {
                                "href": "https://api-m.sandbox.paypal.com/v2/checkout/orders/89R50479BK464364E",
                                "rel": "up",
                                "method": "GET"
                            }
                        ],
                        "create_time": "2024-02-29T18:37:16Z",
                        "update_time": "2024-02-29T18:37:16Z"
                    }
                ]
            }
        }
    ],
    "payer": {
        "name": {
            "given_name": "John",
            "surname": "Doe"
        },
        "email_address": "[email protected]",
        "payer_id": "XBPP8VESHUHDS",
        "address": {
            "country_code": "US"
        }
    },
    "create_time": "2024-02-29T18:37:00Z",
    "update_time": "2024-02-29T18:37:16Z",
    "links": [
        {
            "href": "https://api-m.sandbox.paypal.com/v2/checkout/orders/89R50479BK464364E",
            "rel": "self",
            "method": "GET"
        }
    ]
}
Reference
PayPal.com
Privacy
Support
Legal
Contact