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.
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
{
"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
{
"payment_source": {
"token": {
"id": "{{subscription_id}}",
"type": "BILLING_AGREEMENT"
}
}
}
Response
{
"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"
}
]
}