Immediate capture

DocsCurrent


You can immediately capture money from your buyers and move it to your sellers.

Know before you code

  • Complete Onboard Sellers before you begin this integration.
  • The instructions in Get started will help you get your access token.
  • This server-side integration uses the Orders REST API.
  • You must set intent to capture in the create order call for this feature to work.
  • Use Postman to explore and test PayPal APIs.

1. Create order

Copy the following code and modify it.

Sample request

API endpoint used: Create an order

  1. cURL
  2. Node
1curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders
2-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": "INSTANT",
17 "platform_fees": [{
18 "amount": {
19 "currency_code": "USD",
20 "value": "25.00"
21 }
22 }]
23 }
24}]
25}'

Modify the code

After you copy the code in the sample request, modify the following:

  • Change BN-Code to your PayPal Partner Attribution ID.
  • Use the purchase_units/payee object to specify the end receiver of the funds.
  • Use the purchase_units/payment_instruction/disbursement_mode field to specify when funds should be disbursed to the payee upon calling capture order.
  • Use the purchase_units/payment_instruction/platform_fees array to specify fees for the order. You must onboard your seller with the PARTNER_FEE feature to use this array.

2. Capture order

Copy the following code and modify it.

Sample request

API endpoint used: Capture order

  1. cURL
  2. Node
1curl -v -k -X POST https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T/capture
2-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 to APPROVED when the buyer successfully completes the checkout flow.

Modify the code

After you copy the code in the sample request, modify the following:

3. Show order details

API endpoint used: Show order details

Copy the following code and modify it, using the order ID as a path parameter.

Sample request

  1. cURL
  2. Node
1curl -v -X GET https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T
2-H "Content-Type: application/json"
3-H "Authorization: Bearer <Access-Token>"

Modify the code

After you copy the code, modify the following:

  • Change Access-Token to your access token.
  • Pass the order ID as a path parameter.

Next steps

Go live