Delay disbursement
DocsCurrent
You can hold funds captured from a buyer before disbursing to your seller. Holding funds gives you time to conduct additional vetting or enforce other platform-specific business logic.
Know before you code
- Complete Onboard Sellers before you begin this integration. You must onboard your seller with the DELAY_FUNDS_DISBURSEMENT feature to use this integration.
- The instructions in Get started will help you get your access token.
- This server-side integration uses the Orders REST API.
- Delayed disbursement supports:
- Authorization: Set
intent
toauthorize
in the Create order call to authorize a payment and place funds on hold after the customer makes a payment. - Capture: Set
intent
tocapture
in the create order call to capture payment immediately after the customer makes a payment.
- Authorization: Set
- In this example, funds are held before disbursing. To capture immediately, use Immediate capture.
Use Postman to explore and test PayPal APIs.
1. Create order
Before delaying disbursement, you must first create an order and capture funds. Use the following code to create an order:
- cURL
- Node
1curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders2-H 'Content-Type: application/json'3-H 'Authorization: Bearer <Access-Token>'4-H 'PayPal-Partner-Attribution-Id: <BN-Code>'5-d '{6"intent": "CAPTURE",7"purchase_units": [{8 "amount": {9 "currency_code": "USD",10 "value": "100.00"11 },12 "payee": {13 "email_address": "seller@example.com"14 },15 "payment_instruction": {16 "disbursement_mode": "DELAYED",17 "platform_fees": [{18 "amount": {19 "currency_code": "USD",20 "value": "25.00"21 }22 }]23 }24 }]25}'
- Use the
intent
field to determine when you want to capture funds. In this example,intent
is set toCAPTURE
to immediately capture the funds. - Use the
purchase_units/payee
object to specify the end receiver of the funds. - Set the
purchase_units/payment_instruction/disbursement_mode
field toDELAYED
. - Use the
purchase_units/payment_instruction/platform_fees
array to specify fees for the order. You must onboard your seller with thePARTNER_FEE
feature to use this array.
2. Capture order
Next, after your buyer approves the order, call capture order to capture the buyer's funds.
- cURL
- Node
1curl -v -k -X POST https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T/capture2-H 'PayPal-Partner-Attribution-Id: <BN-Code>'3-H 'Authorization: Bearer <Access-Token>'4-H 'Content-Type: application/json'5-d '{}'
Note: Orders cannot be captured until the status of the order is set to
APPROVED
. The order status is set toAPPROVED
when the buyer successfully completes the checkout flow.
3. Show order details
To see your order details, pass the order ID as a path parameter in a show order details call.
- cURL
- Node
1curl -v -X GET https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T2-H "Content-Type: application/json"3-H "Authorization: Bearer <Access-Token>"
A successful request returns the HTTP 200 OK status
code and a JSON response body that shows order details.
{
"id": "5O190127TN364715T",
"status": "CREATED",
"intent": "CAPTURE",
"purchase_units": [
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
],
"create_time": "2018-04-01T21:18:49Z",
"links": [
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T",
"rel": "approve",
"method": "GET"
},
{
"href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T/capture",
"rel": "capture",
"method": "POST"
}
]
}
4. Disburse funds
Once funds are captured, call /v1/payments/referenced-payouts-items to disburse funds to your seller. To make this call you must pass a reference_id
. You retrieve the reference_id
by making a show order details call and reading the purchase_units/payments/captures/id
field.
curl -v https://api-m.sandbox.paypal.com/v1/payments/referenced-payouts-items \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Access-Token>" \
-H "PayPal-Partner-Attribution-Id: <BN-Code>" \
-d '{
"reference_id": "29N36144XH0198422",
"reference_type": "TRANSACTION_ID"
}'
Funds are automatically disbursed to the seller after 28 days.
Note: PayPal deducts fees from the seller’s funds.