Authorize a payment and capture funds later

SDKCurrentStandardPartner

Last updated: Sept 25th, 4:22pm

The PayPal Checkout integration supports a 2-step authorize and capture payment model.

Authorize a buyer's funds before you capture them, then settle the purchase later. An authorization places a hold on the funds and is valid for 29 days. For example, use authorize and capture to complete a task before finalizing the payment, such as verifying that you have the item in stock.

How it works

  1. The payer checks out and provides a payment method.
  2. You authorize the payment.
  3. A hold is placed on the payment method until you are ready to capture payment.
  4. You finalize the transaction and capture the payment.
  5. The payer's payment method is charged.

Partner requirements

  • You must be an approved partner to use this integration.
  • You must complete seller onboarding before you use this integration.
  • You must have an access token.
  • This integration is a PCI Compliant - SAQ A solution for accepting credit card payments directly on your website.

Know before you code

Required
Standard Checkout

Complete the steps in Get started to get your sandbox account login information and access token from the Developer Dashboard.

This feature modifies an existing standard Checkout integration and uses the following:

Standard CheckoutGet started

Required
You need a developer account to get sandbox credentials

PayPal uses the following REST API credentials, which you can get from the developer dashboard:

  • Client ID: Authenticates your account with PayPal and identifies an app in your sandbox.
  • Client secret: Authorizes an app in your sandbox. Keep this secret safe and don't share it.

Optional
Explore PayPal APIs with Postman

You can use Postman to explore and test PayPal APIs. Learn more in our Postman guide.

1

Separate authorize and capture in the approval intent

The default approval intent of the JavaScript SDK is to both authorize the transaction and capture payment immediately. To split authorize and capture into separate actions, add &intent=authorize to the JavaScript SDK script tag, as shown in the following example:

    1<script
    2 src="https://www.paypal.com/sdk/js?client-id=CLIENT_ID&intent=authorize">
    3</script>
    2

    Create order

    Before you authorize funds, you must create an order with the intent field set to AUTHORIZE.

    Use the purchase_units/payee object to specify the end receiver of the funds.

    3

    Authorize order

    After your buyer approves the order, you call the Authorize order endpoint of the Orders v2 API to authorize the buyer's funds.

    Use the purchase_units/payee object to specify the end receiver of the funds.

    1. cURL
    2. Node
    1curl -v -k -X POST https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T/authorize \\
    2 -H 'PayPal-Partner-Attribution-Id: BN-CODE' \\
    3 -H 'Authorization: Bearer ACCESS-TOKEN' \\
    4 -H 'Content-Type: application/json' \\
    5 -d '{}'

    An authorization places a hold on the funds and is valid for 29 days.

    After a successful authorization, PayPal recommends that you capture the funds within the 3-day honor period. Success of the capture is subject to risk and availability of funds on the authorized funding instrument.

    Within the 29-day authorization period, you can issue multiple re-authorizations after the honor period expires. A re-authorization generates a new Authorization ID and restarts the honor period. Any subsequent capture should be performed on the new Authorization ID. If you do a re-authorization on the 27th day of the authorization, you get only 2 days of honor period.

    You can capture less than the original authorization, full authorization amount, or even more than the authorization amount (up to 115% of the original authorization or $75 USD more, whichever is less).

    4

    Capture authorization

    When you are ready to capture the funds you authorized, call /v2/payments/authorizations/{authorization_id}/capture. You can retrieve the authorization_id from the purchase_units/payments/authorizations/id field of the response from the previous step to authorize an order or from a show order details call.

      1curl -v -X POST https://api-m.sandbox.paypal.com/v2/payments/authorizations/5O190127TN364715T/capture \
      2 -H "Content-Type: application/json" \
      3 -H "Authorization: Bearer <Access-Token>" \
      4 -d '{
      5 "payment_instruction": {
      6 "disbursement_mode": "INSTANT",
      7 "platform_fees": [
      8 {
      9 "amount": {
      10 "currency_code": "USD",
      11 "value": "2.00"
      12 }
      13 }
      14 ]
      15 }
      16 }'
      • Use the payment_instruction/disbursement_mode field to specify when funds should be disbursed to the seller. To capture these funds and hold them before disbursing to the seller, see the Delay Disbursements guide.
      • Use the payment_instruction/platform_fees array to specify any fees you want to collect on this transaction. You must onboard your seller with the PARTNER_FEE feature to use this array.

      If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more