NAV
cURL

Introduction

WooCommerce Payments REST APIs build upon the WooCommerce REST interface which itself extends the WordPress REST APIs. Consuming, testing and debugging WCPay APIs is exactly the same as Woo APIs.

For requirements, request/response format, and other details refer to the WooCommerce REST API docs.

Authentication

WooCommerce includes two ways to authenticate with the WP REST API. It is also possible to authenticate using any WP REST API authentication plugin or method.

Refer to the WooCommerce REST API docs for more options and possibilities.

Generate API keys

Pre-generated keys can be used to authenticate use of the REST API endpoints. New keys can be generated either through the WordPress admin interface or they can be auto-generated through an endpoint.

To create or manage keys for a specific WordPress user, go to WooCommerce > Settings > Advanced > REST API.

Note: Keys/Apps was found at WooCommerce > Settings > API > Key/Apps prior to WooCommerce 3.4.

WooCommerce REST API keys settings

Click the "Add Key" button. In the next screen, add a description and select the WordPress user you would like to generate the key for. Use of the REST API with the generated keys will conform to that user's WordPress roles and capabilities.

Choose the level of access for this REST API key, which can be Read access, Write access or Read/Write access. Then click the "Generate API Key" button and WooCommerce will generate REST API keys for the selected user.

Creating a new REST API key

Now that keys have been generated, you should see two new keys, a QRCode, and a Revoke API Key button. These two keys are your Consumer Key and Consumer Secret.

Generated REST API key

If the WordPress user associated with an API key is deleted, the API key will cease to function. API keys are not transferred to other users.

Order

The order API allows you to perform operations such as capture a terminal payment, create an intent, create a customer, etc. for a particular order.

Create a terminal intent

@since v3.5.0

Create a new in-person payment intent for the given order ID without confirming it.

Error codes

HTTP request

POST
/wp-json/wc/v3/payments/orders/<order_id>/create_terminal_intent

Optional parameters

curl -X POST https://example.com/wp-json/wc/v3/payments/orders/42/create_terminal_intent \
    -u consumer_key:consumer_secret

JSON response example:

{
    "id": "pi_ZZZZZZZZZZZZZZZZAAAAAAAA"
}
{
    "code": "wcpay_intent_creation_error",
    "message": "Intent creation failed with the following message: <reason>",
    "data": {
        "status": 500
    }
}

Capture a terminal payment

@since v2.4.0

Capture the funds of an in-person payment intent. Given an intent ID and an order ID, add the intent ID to the order and capture it.

POST params

Error codes

HTTP request

POST
/wp-json/wc/v3/payments/orders/<order_id>/capture_terminal_payment
curl -X POST https://example.com/wp-json/wc/v3/payments/orders/42/capture_terminal_payment \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
    "payment_intent_id": "pi_ZZZZZZZZZZZZZZZZAAAAAAAA"
}'

JSON response example:

{
    "status": "succeeded",
    "id": "pi_ZZZZZZZZZZZZZZZZAAAAAAAA"
}
{
    "code": "wcpay_server_error",
    "message": "Unexpected server error",
    "data": {
        "status": 500
    }
}

Capture an authorization

@since v5.1.0

Capture the funds of an existing uncaptured payment intent that was marked to be captured manually later.

POST params

Error codes

HTTP request

POST
/wp-json/wc/v3/payments/orders/<order_id>/capture_authorization
curl -X POST https://example.com/wp-json/wc/v3/payments/orders/42/capture_authorization \
  -u consumer_key:consumer_secret \
  -H "Content-Type: application/json" \
  -d '{
    "payment_intent_id": "pi_ZZZZZZZZZZZZZZZZAAAAAAAA"
}'

JSON response example:

{
    "status": "succeeded",
    "id": "pi_ZZZZZZZZZZZZZZZZAAAAAAAA"
}
{
    "code": "wcpay_payment_uncapturable",
    "message": "The payment cannot be captured",
    "data": {
        "status": 409
    }
}

Cancel an authorization

@since v5.7.0

Cancel the authorization of an existing uncaptured payment intent.

POST params

Error codes

HTTP request

POST
/wp-json/wc/v3/payments/orders/<order_id>/cancel_authorization
curl -X POST https://example.com/wp-json/wc/v3/payments/orders/42/cancel_authorization \
  -u consumer_key:consumer_secret \
  -H "Content-Type: application/json" \
  -d '{
    "payment_intent_id": "pi_ZZZZZZZZZZZZZZZZAAAAAAAA"
}'

JSON response example:

{
    "status": "canceled",
    "id": "pi_ZZZZZZZZZZZZZZZZAAAAAAAA"
}
{
    "code": "wcpay_missing_order",
    "message": "Order not found",
    "data": {
        "status": 409
    }
}

Create customer

@since v2.8.0

Returns customer id from order. Create or update customer if needed.

Error codes

HTTP request

POST
/wp-json/wc/v3/payments/orders/<order_id>/create_customer
curl -X POST https://example.com/wp-json/wc/v3/payments/orders/42/create_customer \
    -u consumer_key:consumer_secret

JSON response example:

{
    "id": "i_am_awesome"
}
{
    "code": "wcpay_server_error",
    "message": "Unexpected server error",
    "data": {
        "status": 500
    }
}

Authorization

An authorization is an uncaptured transaction marked for manual capture later, or more technically a payment intent with requires_capture status. An authorization must be captured within 7 days after which it expires and becomes unavailable for capture.

An authorization may be captured from one of these pages - Order details, Uncapture transactions, Payment details.

The authorization API allows you to get data related to authorizations.

Get authorizations

@since v4.9.0

Return all active authorizations.

GET params

Error codes

HTTP request

GET
/wp-json/wc/v3/payments/authorizations?page=1&pagesize=10&sort=created&direction=DESC
curl -X GET https://example.com/wp-json/wc/v3/payments/authorizations?page=1&pagesize=10&sort=created&direction=DESC \
  -u consumer_key:consumer_secret \
  -H "Content-Type: application/json"

JSON response example:

{
    "data": [
        {
            "charge_id": "ch_123",
            "transaction_id": null,
            "amount": 1800,
            "net": 1720,
            "amount_captured": 0,
            "amount_refunded": 0,
            "is_captured": false,
            "created": "2022-11-03 08:56:14",
            "modified": "2022-11-03 08:56:16",
            "channel": "online",
            "source": "visa",
            "source_identifier": "4242",
            "customer_name": "Mr. Albert",
            "customer_email": "mr.albert@email.com",
            "customer_country": "US",
            "fees": 80,
            "currency": "usd",
            "risk_level": 0,
            "payment_intent_id": "pi_123",
            "refunded": false,
            "order_id": 329,
            "outcome_type": "authorized",
            "status": "succeeded"
        }
    ]
}
{
    "code": "wcpay_bad_request",
    "message": "Error: Invalid sorting direction: ",
    "data": null
}

Get authorization

@since v4.9.0

Return data for a specific authorization.

HTTP request

GET
/wp-json/wc/v3/payments/authorizations/<payment_intent_id>
curl -X GET https://example.com/wp-json/wc/v3/payments/authorizations/pi_123 \
  -u consumer_key:consumer_secret \
  -H "Content-Type: application/json"

JSON response example:

{
    "wcpay_charges_cache_id": 17,
    "stripe_account_id": "acct_123",
    "charge_id": "ch_123",
    "transaction_id": null,
    "amount": 1800,
    "net": 1720,
    "amount_captured": 0,
    "amount_refunded": 0,
    "is_captured": false,
    "created": "2022-11-03 08:56:14",
    "modified": "2022-11-03 08:56:16",
    "channel": "online",
    "source": "visa",
    "source_identifier": "4242",
    "customer_name": "Mr. Albert",
    "customer_email": "mr.albert@email.com",
    "customer_country": "US",
    "fees": 80,
    "currency": "usd",
    "risk_level": 0,
    "payment_intent_id": "pi_123",
    "refunded": false,
    "order_id": 329,
    "outcome_type": "authorized",
    "status": "succeeded"
}

Get authorization summary

@since v4.9.0

Return a high-level summary for all active authorizations.

HTTP request

GET
/wp-json/wc/v3/payments/authorizations/summary
curl -X GET https://example.com/wp-json/wc/v3/payments/authorizations/summary \
  -u consumer_key:consumer_secret \
  -H "Content-Type: application/json"

JSON response example:

{
    "count": 3,
    "currency": "usd",
    "total": 5400,
    "all_currencies": [ "usd" ]
}

Customer

The Customers API endpoints provide access to customer data. This includes payment methods and other key information useful for your application.

Get customer's payment methods

@since v6.6.0

Return all customer's payment methods.

Error codes

HTTP request

GET
/wp-json/wc/v3/payments/customers/<customer_id>/payment_methods
curl -X GET https://example.com/wp-json/wc/v3/payments/customers/cus_123456/payment_methods \
  -u consumer_key:consumer_secret \
  -H "Content-Type: application/json"

JSON response example:

[
  {
    "id": "pm_1AxXc2a5dGhIZQYPlaLbKj1Z",
    "type": "card",
    "billing_details": {
      "address": {
        "city": "Los Angeles",
        "country": "US",
        "line1": "123 Anywhere St",
        "line2": null,
        "postal_code": "90002",
        "state": "CA"
      },
      "email": "john.doe@example.com",
      "name": "John Doe",
      "phone": null
    },
    "card": {
      "brand": "visa",
      "last4": "1122",
      "exp_month": 10,
      "exp_year": 2028
    }
  },
  {
    "id": "pm_2BcYd3e6hKjZLQWQmMnOjK45",
    "type": "card",
    "billing_details": {
      "address": {
        "city": "New York",
        "country": "US",
        "line1": "456 Broadway Ave",
        "line2": null,
        "postal_code": "10012",
        "state": "NY"
      },
      "email": "jane.smith@example.com",
      "name": "Jane Smith",
      "phone": null
    },
    "card": {
      "brand": "mastercard",
      "last4": "3344",
      "exp_month": 12,
      "exp_year": 2027
    }
  }
]

{
  "code":"rest_forbidden",
  "message":"Sorry, you are not allowed to do that.",
  "data":{
    "status":401
  }
}

Payment intents

The Payment Intents API provides comprehensive functionality for managing payment intents. You can create and manage them seamlessly through its endpoints.

Create payment intent

@since v6.6.0

Create new payment intent.

Error codes

HTTP request

POST
/wp-json/wc/v3/payments/payment_intents
curl -X POST https://example.com/wp-json/wc/v3/payments/payment_intents \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{"payment_method":"<pm_id>","customer":"<customer_id>","order_id":"<order_id>"}'

JSON response example:

{
  "id": "pi_4NxlPtR3eYmZSVZP0PPpwee8",
  "amount": 1023,
  "currency": "USD",
  "created": 1696496578,
  "customer": "cus_OUQoHGzJLw87Tk",
  "payment_method": "pm_2NlT19R3eYmZSVZPRJEvxvwF",
  "status": "succeeded",
  "charge": {
    "id": "ch_4NxlPtR3eYmZSVZP0ZLpKjfI",
    "amount": 1023,
    "application_fee_amount": 62,
    "status": "succeeded",
    "billing_details": {
      "address": {
        "city": "San Francisco",
        "country": "US",
        "line1": "123 Random St",
        "line2": "-",
        "postal_code": "94101",
        "state": "CA"
      },
      "email": "random.email@example.com",
      "name": "John Doe",
      "phone": "5555555555"
    },
    "payment_method_details": {
      "card": {
        "amount_authorized": 1023,
        "brand": "mastercard",
        "capture_before": "",
        "country": "US",
        "exp_month": 5,
        "exp_year": 2030,
        "last4": "4321",
        "three_d_secure": ""
      }
    }
  }
}

{
  "code":"rest_forbidden",
  "message":"Sorry, you are not allowed to do that.",
  "data":{
    "status":401
  }
}

Reports

The Reports API allows you to obtain detailed records of transactions and authorizations.

List transactions

@since 6.5.0

Fetch a detailed overview of transactions.

Error codes

HTTP request

GET
/wp-json/wc/v3/payments/reports/transactions

Optional parameters

curl -X POST https://example.com/wp-json/wc/v3/payments/reports/transactions?page=1 \
    -u consumer_key:consumer_secret

JSON response example:

[
  {
    "date":"2023-10-01 15:00:00",
    "transaction_id":"txn_1234567890abcdef",
    "payment_id":"pi_1234567890abcdef",
    "channel":"online",
    "payment_method":{
      "type":"card",
      "id":"pm_1234567890abcdef"
    },
    "type":"charge",
    "transaction_currency":"USD",
    "amount":1000,
    "exchange_rate":1.00,
    "deposit_currency":"USD",
    "fees":20,
    "customer":{
      "name":"John Doe",
      "email":"john.doe@example.com",
      "country":"US"
    },
    "net_amount":980,
    "order_id":12345,
    "risk_level":1,
    "deposit_date":"2023-10-02 15:00:00",
    "deposit_id":"dp_1234567890abcdef",
    "deposit_status":"completed"
  }
]

List transaction

@since 6.5.0

Fetch a detailed overview of single transaction.

Error codes

HTTP request

GET
/wp-json/wc/v3/payments/reports/transactions/<transaction_id>
curl -X POST https://example.com/wp-json/wc/v3/payments/reports/transactions/txn_1234567890abcdef \
    -u consumer_key:consumer_secret

JSON response example:

{
  "date": "2023-10-01 15:00:00",
  "transaction_id": "txn_1234567890abcdef",
  "payment_id": "pi_1234567890abcdef",
  "channel": "online",
  "payment_method": {
    "type": "card",
    "id": "pm_1234567890abcdef"
  },
  "type": "charge",
  "transaction_currency": "USD",
  "amount": 1000,
  "exchange_rate": 1.00,
  "deposit_currency": "USD",
  "fees": 20,
  "customer": {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "country": "US"
  },
  "net_amount": 980,
  "order_id": 12345,
  "risk_level": 1,
  "deposit_date": "2023-10-02 15:00:00",
  "deposit_id": "dp_1234567890abcdef",
  "deposit_status": "completed"
}

List authorizations

@since 6.5.0

Fetch a detailed overview of authorizations.

Error codes

HTTP request

GET
/wp-json/wc/v3/payments/reports/authorizations

Optional parameters

curl -X POST https://example.com/wp-json/wc/v3/payments/reports/authorizations?page=1 \
    -u consumer_key:consumer_secret

JSON response example:

[
  {
    "authorization_id":"auth_98765",
    "date":"2023-09-30 15:05:00",
    "payment_id":"pi_12345",
    "channel":"online",
    "payment_method":{
      "type":"card",
      "id":"pm_abc12345"
    },
    "currency":"USD",
    "amount":1000,
    "amount_captured":0,
    "fees":20,
    "customer":{
      "name":"John Doe",
      "email":"john.doe@example.com",
      "country":"US"
    },
    "net_amount":980,
    "order_id":45678,
    "risk_level":1
  }
]

List authorization

@since 6.5.0

Fetch a detailed overview of single authorization.

Error codes

HTTP request

GET
/wp-json/wc/v3/payments/reports/authorizations/<authorization_id>
curl -X POST https://example.com/wp-json/wc/v3/payments/reports/authorizations/auth_98765 \
    -u consumer_key:consumer_secret

JSON response example:

{
  "authorization_id":"auth_98765",
  "date":"2023-09-30 15:05:00",
  "payment_id":"pi_12345",
  "channel":"online",
  "payment_method":{
    "type":"card",
    "id":"pm_abc12345"
  },
  "currency":"USD",
  "amount":1000,
  "amount_captured":0,
  "fees":20,
  "customer":{
    "name":"John Doe",
    "email":"john.doe@example.com",
    "country":"US"
  },
  "net_amount":980,
  "order_id":45678,
  "risk_level":1
}

Deposits

The Deposits API endpoints provide access to an account's deposits data, including an overview of account balances, deposit schedule and deposit history.

Deposit object

{
    "id": "po_1OJ466CBu6Jj8nBr38JRxdNE",
    "date": 1701648000000,
    "type": "deposit",
    "amount": 802872,
    "status": "paid",
    "bankAccount": "STRIPE TEST BANK •••• 3000 (EUR)",
    "currency": "eur",
    "automatic": true,
    "fee": 0,
    "fee_percentage": 0,
    "created": 1701648000
}

Properties

Get deposits overview for all account deposit currencies

Fetch an overview of account deposits for all deposit currencies. This includes details for the last paid deposit, next scheduled deposit, and last manual deposits.

HTTP request

GET
/wp-json/wc/v3/payments/deposits/overview-all

Returns

curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/overview-all \
    -u consumer_key:consumer_secret

JSON response example:

{
    "deposit": {
        "last_paid": [
            {
                "id": "po_1OJ466CBu6Jj8nBr38JRxdNE",
                "date": 1701648000000,
                "type": "deposit",
                "amount": 802872,
                "status": "paid",
                "bankAccount": "STRIPE TEST BANK •••• 3000 (EUR)",
                "currency": "eur",
                "automatic": true,
                "fee": 0,
                "fee_percentage": 0,
                "created": 1701648000
            },
            {
                "id": "po_1OHylNCBu6Jj8nBr95tE8scS",
                "date": 1701302400000,
                "type": "deposit",
                "amount": 471784,
                "status": "paid",
                "bankAccount": "STRIPE TEST BANK •••• 6789 (USD)",
                "currency": "usd",
                "automatic": true,
                "fee": 0,
                "fee_percentage": 0,
                "created": 1701302400
            }
        ],
        "last_manual_deposits": []
    },
    "balance": {
        "pending": [
            {
                "amount": -114696,
                "currency": "eur",
                "source_types": {
                    "card": -114696
                }
            },
            {
                "amount": 707676,
                "currency": "usd",
                "source_types": {
                    "card": 707676
                }
            }
        ],
        "available": [
            {
                "amount": 573480,
                "currency": "eur",
                "source_types": {
                    "card": 573480
                }
            },
            {
                "amount": 587897,
                "currency": "usd",
                "source_types": {
                    "card": 587897
                }
            }
        ],
        "instant": [
            {
                "amount": 12345,
                "currency": "usd",
                "fee": 185,
                "fee_percentage": 1.5,
                "net": 0
            }
        ]
    },
    "account": {
        "deposits_enabled": true,
        "deposits_blocked": false,
        "deposits_schedule": {
            "delay_days": 7,
            "interval": "weekly",
            "weekly_anchor": "friday"
        },
        "default_currency": "eur",
        "default_external_accounts": [
            {
                "currency": "eur",
                "status": "new"
            },
            {
                "currency": "usd",
                "status": "new"
            }
        ]
    }
}

List deposits

Fetch a list of deposits.

HTTP request

GET
/wp-json/wc/v3/payments/deposits

Required parameters

Optional parameters

Returns

curl -X GET https://example.com/wp-json/wc/v3/payments/deposits?sort=date \
    -u consumer_key:consumer_secret

JSON response example:

{
    "data": [
        {
            "id": "po_1OJ466CBu6Jj8nBr38JRxdNE",
            "date": 1701648000000,
            "type": "deposit",
            "amount": 802872,
            "status": "paid",
            "bankAccount": "STRIPE TEST BANK •••• 3000 (EUR)",
            "currency": "eur",
            "automatic": true,
            "fee": 0,
            "fee_percentage": 0,
            "created": 1701648000
        },
        {
            "id": "po_1OHylNCBu6Jj8nBr95tE8scS",
            "date": 1701302400000,
            "type": "deposit",
            "amount": 471784,
            "status": "paid",
            "bankAccount": "STRIPE TEST BANK •••• 6789 (USD)",
            "currency": "usd",
            "automatic": true,
            "fee": 0,
            "fee_percentage": 0,
            "created": 1701302400
        }
    ],
    "total_count": 2
}

Get deposits summary

Fetches a summary of deposits matching the query. This includes the total number of deposits matching the query and a list of deposits.

Useful in combination with the List deposits endpoint to get a summary of deposits matching the query without having to fetch the full list of deposits.

HTTP request

GET
/wp-json/wc/v3/payments/deposits/summary

Optional parameters

Returns

curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/summary \
    -u consumer_key:consumer_secret

JSON response example:

{
    "count": 42,
    "store_currencies": [ "chf", "eur", "gbp", "nok", "sek", "usd", "dkk" ],
    "total": 5744395,
    "currency": "eur"
}

Get deposit

Fetches a deposit by ID.

HTTP request

GET
/wp-json/wc/v3/payments/deposits/{deposit_id}

Returns

If a deposit is found for the provided ID, the response will return a Deposit object.

If no deposit is found for the provided ID, the response will return a 500 status code.

curl -X GET https://example.com/wp-json/wc/v3/payments/deposits/po_123abc \
    -u consumer_key:consumer_secret

JSON response example:

{
    "id": "po_1OGAFOCBu6Jj8nBruJbMbGqD",
    "date": 1701043200000,
    "type": "deposit",
    "amount": 114696,
    "status": "paid",
    "bankAccount": "STRIPE TEST BANK •••• 3000 (EUR)",
    "currency": "eur",
    "automatic": true,
    "fee": 0,
    "fee_percentage": 0,
    "created": 1701043200
}

Submit an instant deposit

Submit an instant deposit for a list of transactions. Only for eligible accounts. See Instant Deposits with WooPayments for more information.

HTTP request

POST
/wp-json/wc/v3/payments/deposits

Required body properties

curl -X POST 'https://example.com/wp-json/wc/v3/payments/deposits' \
  -u consumer_key:consumer_secret
  --data '{
      "type": "instant",
      "currency": "usd"
    }'

Request a CSV export of deposits

Request a CSV export of deposits matching the query. A link to the exported CSV will be emailed to the provided email address or the account's primary email address if no email address is provided.

HTTP request

POST
/wp-json/wc/v3/payments/deposits/download

Optional body properties

Optional parameters

Returns

curl -X POST 'https://example.com/wp-json/wc/v3/payments/deposits/download?status_is=paid' \
  -u consumer_key:consumer_secret
  --data '{
      "user_email": "name@example.woocommerce.com"
    }'

JSON response example:

{
    "exported_deposits": 42
}