Airwallex logo

Payment Sources

Copy for LLMView as Markdown

A Payment Source represents a Billing Customer's funding instrument that can be used to pay for invoices.

Endpoints
POST /api/v1/billing/payment_sources/create
GET /api/v1/billing/payment_sources/{id}
GET /api/v1/billing/payment_sources

Create a payment source

POST /api/v1/billing/payment_sources/create

Creates a PaymentSource using a linked payment method from a supported Payment Service Provider (PSP). When Airwallex Payments is used as the PSP, you can create a PaymentSource with a PaymentMethod authorized for merchant-initiated payments. This authorization can be obtained in two ways:

  • Indirectly, by creating a PaymentIntent with payment_consent.next_triggered_by=merchant, and payment_consent.merchant_trigger_reason=unscheduled.
  • Directly, by creating a PaymentConsent with next_triggered_by=merchant, and merchant_trigger_reason=unscheduled.

For more details, refer to the PaymentIntents API and PaymentConsents API documentation.

Request body
billing_customer_idrequiredstring

ID of the Billing Customer that this Payment Source belongs to.

external_idrequiredstring

ID of the Payment Method associated with the Payment Source.

request_idrequiredstring

Unique request ID specified by the merchant.

linked_payment_account_idstring

ID of the linked payment account to collect payment. You can find this ID in the Airwallex web app > Settings > Account details, within the Account Information section. Required if you have more than 1 payment account in your organisation.

metadataobject

A set of string key-value pairs that you can attach to this object for storing additional information.

Response body - 201 Created
billing_customer_idstring

ID of the Billing Customer that this Payment Source belongs to.

created_atstring

Time when this Payment Source was created.

external_idstring

ID of the Payment Method associated with the Payment Source.

idstring

ID of the Payment Source object.

linked_payment_account_idstring

ID of the linked payment account to collect payment. You can find this ID in the Airwallex web app > Settings > Account details, within the Account Information section.

metadataobject

A set of string key-value pairs that you can attach to this object for storing additional information.

updated_atstring

Time when this Payment Source was last updated.

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error, duplicate_request_id

401

Unauthorized. Possible error codes: unauthorized

500

Server Error. Possible error codes: internal_error

POST /api/v1/billing/payment_sources/create
$curl --request POST \
> --url 'https://api.sandbox.airwallex.com/api/v1/billing/payment_sources/create' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json' \
> --data '{
> "billing_customer_id": "bcus_hkpd7fedfgb004apkvs",
> "external_id": "mtd_hkpd1dsjklad5sa",
> "linked_payment_account_id": "acct_ncI2nypPKSq2VXKxscAcg",
> "metadata": {
> "foo": "bar"
> },
> "request_id": "ee939540-3203-4a2c-9172-89a566485dd9"
>}'
Response (201 Created)
1{
2 "billing_customer_id": "bcus_hkpd7fedfgb004apkvs",
3 "created_at": "2022-01-01T10:15:30+0000",
4 "external_id": "mtd_hkpd1dsjklad5sa",
5 "id": "psrc_d3Ds20ae5VihKs092",
6 "linked_payment_account_id": "acct_ncI2nypPKSq2VXKxscAcg",
7 "metadata": {
8 "foo": "bar"
9 },
10 "updated_at": "2022-01-01T10:15:30+0000"
11}
Was this section helpful?

Retrieve a payment source

GET /api/v1/billing/payment_sources/{id}

Retrieves the details of a Payment Source.

Parameters
idrequiredstring

ID of the Payment Source object.

Response body - 200 OK
billing_customer_idstring

ID of the Billing Customer that this Payment Source belongs to.

created_atstring

Time when this Payment Source was created.

external_idstring

ID of the Payment Method associated with the Payment Source.

idstring

ID of the Payment Source object.

linked_payment_account_idstring

ID of the linked payment account to collect payment. You can find this ID in the Airwallex web app > Settings > Account details, within the Account Information section.

metadataobject

A set of string key-value pairs that you can attach to this object for storing additional information.

updated_atstring

Time when this Payment Source was last updated.

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error

401

Unauthorized. Possible error codes: unauthorized

404

Not Found. Possible error codes: resource_not_found

500

Server Error. Possible error codes: internal_error

GET /api/v1/billing/payment_sources/{id}
$curl --request GET \
> --url 'https://api.sandbox.airwallex.com/api/v1/billing/payment_sources/payment_source_id' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json'
Response (200 OK)
1{
2 "billing_customer_id": "bcus_hkpd7fedfgb004apkvs",
3 "created_at": "2022-01-01T10:15:30+0000",
4 "external_id": "mtd_hkpd1dsjklad5sa",
5 "id": "psrc_d3Ds20ae5VihKs092",
6 "linked_payment_account_id": "acct_ncI2nypPKSq2VXKxscAcg",
7 "metadata": {
8 "foo": "bar"
9 },
10 "updated_at": "2022-01-01T10:15:30+0000"
11}
Was this section helpful?

Get list of payment sources

GET /api/v1/billing/payment_sources

Retrieves a list of Payment Sources based on the query parameters.

Parameters
billing_customer_idstring

ID of the Billing Customer that the Payment Source belongs to.

external_idstring

The corresponding Payment Source ID on the payment provider's side. For Airwallex, this is the Payment Method ID.

from_created_atstring

The start time of created_at in ISO8601 format (inclusive).

linked_payment_account_idstring

ID of the linked payment account that this Payment Source is created with. You can find this in the "Account ID" section under Account Details in the Settings on the Airwallex Webapp.

pagestring

A bookmark for use in pagination to retrieve either the next page or the previous page of results. You can fetch the value for this identifier from the response of the previous API call. To retrieve the next page of results, pass the value of page_after (if not null) from the response to a subsequent call. To retrieve the previous page of results, pass the value of page_before (if not null) from the response to a subsequent call.

page_sizeinteger

Number of Payment Sources to be listed per page. Defaults to 20.

to_created_atstring

The end time of created_at in ISO8601 format (exclusive).

Response body - 200 OK
itemsarray

Paged results.

items.billing_customer_idstring

ID of the Billing Customer that this Payment Source belongs to.

items.created_atstring

Time when this Payment Source was created.

items.external_idstring

ID of the Payment Method associated with the Payment Source.

items.idstring

ID of the Payment Source object.

items.linked_payment_account_idstring

ID of the linked payment account to collect payment. You can find this ID in the Airwallex web app > Settings > Account details, within the Account Information section.

items.updated_atstring

Time when this Payment Source was last updated.

items.metadataobject

A set of string key-value pairs that you can attach to this object for storing additional information.

page_afterstring

The page cursor used for searching after page.

page_beforestring

The page cursor used for search before page.

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error

401

Unauthorized. Possible error codes: unauthorized

500

Server Error. Possible error codes: internal_error

GET /api/v1/billing/payment_sources
$curl --request GET \
> --url 'https://api.sandbox.airwallex.com/api/v1/billing/payment_sources' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json'
Response (200 OK)
1{
2 "items": [
3 {
4 "billing_customer_id": "bcus_hkpd7fedfgb004apkvs",
5 "created_at": "2022-01-01T10:15:30+0000",
6 "external_id": "mtd_hkpd1dsjklad5sa",
7 "id": "psrc_d3Ds20ae5VihKs092",
8 "linked_payment_account_id": "acct_ncI2nypPKSq2VXKxscAcg",
9 "metadata": {
10 "foo": "bar"
11 },
12 "updated_at": "2022-01-01T10:15:30+0000"
13 }
14 ],
15 "page_after": "<string>",
16 "page_before": "<string>"
17}
Was this section helpful?