# Authorize a payment and capture funds later (/platforms/checkout/standard/customize/auth-capture)



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 [#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 [#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](/platforms/create-account/#credential-reference).
* This integration is a [PCI Compliant - SAQ A](https://www.pcisecuritystandards.org/pci_security/completing_self_assessment) solution for accepting credit card payments directly on your website.

> **Warning:** **Important:** Authorization and capture can incur merchant fees in some markets. For more information, see your [PayPal User Agreement](https://www.paypal.com/us/legalhub/home)

## Know before you code [#know-before-you-code]

> **Info:** ### PayPal Checkout [#paypal-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 PayPal Checkout integration and uses the following:
>
> * [JavaScript SDK:](/sdk/js/) Adds PayPal-supported payment methods.
> * [Orders REST API:](/api/orders/v2) Create, update, retrieve, authorize, and capture orders.
>
> [PayPal Checkout](/platforms/checkout/standard/)
>
> [Get started](/platforms/get-started/)

> **Info:** ### You need a developer account to get sandbox credentials [#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.
>
> [Dashboard](/dashboard/)
>
> [Read the guide](/sandbox-testing/overview)

> **Info:** ### Explore PayPal APIs with Postman [#explore-paypal-apis-with-postman]
>
> You can use Postman to explore and test PayPal APIs. Learn more in our [Postman guide](/api/rest/postman).

## 1. Separate authorize and capture in the approval intent [#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:

```text lineNumbers
<script
  src="https://www.paypal.com/sdk/js?client-id=CLIENT_ID&intent=authorize">
</script>
```

## 2. Create order [#2-create-order]

Before you authorize funds, you must [create an order](/api/orders/v2/orders-create) with the `intent` field set to `AUTHORIZE`.

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

## 3. Authorize order [#3-authorize-order]

After your buyer approves the order, you call the [Authorize order endpoint of the Orders v2 API](/api/orders/v2/orders-authorize) to authorize the buyer's funds.

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

#### cURL

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

#### Node

```text lineNumbers
var express = require('express');
var request = require('request');
express()
  .post('/my-server/handle-approve/:id', function(req, res) {
    var OrderID = req.params.id;
    request.post('https://api-m.sandbox.paypal.com/v2/checkout/orders/' + OrderID + '/authorize', {
        headers: {
            Content-Type: "application/json",
            Authorization: "Bearer ACCESS-TOKEN",
            PayPal-Partner-Attribution-Id: BN-CODE
        }
    }, function(err, response, body) {
        if (err) {
            console.error(err);
            return res.sendStatus(500);
        }
        res.json({
            status: 'success'
        });
    });
});
```

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).

> **Tip:** **Note:** Orders can't be authorized until the status of the order is set to `APPROVED`. The order status is set to `APPROVED` when the buyer successfully completes the [checkout](/platforms/checkout/standard/integrate/) flow.

## 4. Capture authorization [#4-capture-authorization]

When you are ready to capture the funds you authorized, call [/v2/payments/authorizations/\{authorization\_id}/capture](/api/payments/v2/authorizations-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](/api/orders/v2/orders-authorize) or from a [show order details](/api/orders/v2/orders-get) call.

```text lineNumbers
curl -v -X POST https://api-m.sandbox.paypal.com/v2/payments/authorizations/5O190127TN364715T/capture \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>" \
  -d '{
    "payment_instruction": {
      "disbursement_mode": "INSTANT",
      "platform_fees": [
        {
          "amount": {
            "currency_code": "USD",
            "value": "2.00"
           }
        }
      ]
    }
  }'
```

* 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](/platforms/checkout/delayed-disbursement/) 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](/platforms/seller-onboarding/onboarding-checklist/#features) feature to use this array.

## Next steps and customizations [#next-steps-and-customizations]

> **Info:** Implement 3D Secure
>
> Authenticate cardholders through card issuers.

> **Info:** Payments API
>
> Learn more about the Payments API.

> **Info:** Void an authorization
>
> Cancel an authorized payment using the Payments API.

> **Info:** Delay disbursement
>
> Hold funds before disbursement using the Orders and Payments APIs.

> **Info:** Handle a refund
>
> Refund a captured payment using the Payments API.
