跳到主要內容

查詢結帳

要使用 Payfect API 查結帳信息,您需要對 /checkouts/{id}/ 端點發出一個 GET 請求,其中 {id} 是您希望查詢結帳會話的唯一標識符。

Endpoint

GET /checkouts/{id}/

URL Parameters

Parameter NameTypeRequiredDescription
idStringYesUnique identifier for the checkout session to be queried.

Response Structure

The response for the Query a Checkout API call will return a JSON object containing details of the requested checkout session. Below is a detailed description of each field in the response:

Field NameTypeDescription
idStringUnique identifier for the checkout session.
merchantObjectContains merchant's id and name.
nameCollectionBooleanIndicates if the customer name is collected.
emailCollectionBooleanIndicates if the customer email is collected.
phoneNumberCollectionBooleanIndicates if the customer phone number is collected.
shippingAddressCollectionObjectDetails of the shipping address collection.
invoiceItemsArrayArray of invoice items included in the checkout. Each item contains id, price, priceData, quantity and amount.
amountTotalStringTotal amount of the checkout session.
statusStringCurrent status of the checkout session. See Status Values below for more details.
createdAtStringTimestamp of session creation.
updatedAtStringTimestamp of the last update.
clientReferenceIdStringClient reference ID if provided.
currencyStringCurrency code of the session (e.g., 'usdt').
successUrlStringURL to redirect to on success.
cancelUrlStringURL to redirect to on cancel.
expiresAtStringExpiration timestamp for the session.
paymentIntentStringUnique identifier for the payment intent.
paymentMethodTypesArrayList of available payment method types (e.g., 'crypto', 'card').
paymentMethodOptionsObjectOptions available for the payment methods.
urlStringURL of the checkout session.
metadataObjectAdditional metadata related to the checkout.
isLivemodeBooleanIndicates if the session is in live mode.

Status Values

The status field in the response indicates the current state of the checkout session. Possible values include:

  • open: The session is currently open and awaiting completion.
  • complete: The session has been successfully completed.
  • expired: The session has expired and is no longer valid.

Example Response

{
"id": "ed8d24aa-a860-426b-8e56-87cb9f55a081",
"merchant": {
"id": "bf065cc8-343d-4419-be7d-ed2190f1df4d",
"name": "頑碼資訊有限公司"
},
"nameCollection": false,
"emailCollection": false,
"phoneNumberCollection": false,
"shippingAddressCollection": null,
"invoiceItems": [
{
"id": "ee05d205-e4cc-42bd-8897-03c92674c57a",
"price": "3bababfe-5ba8-4afb-84ca-d62c6933704b",
"quantity": 1,
"amount": "20.00"
}
],
"amountTotal": "20.00",
"status": "open",
"createdAt": "1690532072.288761",
"updatedAt": "1690532073.498443",
"clientReferenceId": "5ae50223-e455-4a72-a48d-fe7d85800e64",
"currency": "usdt",
"successUrl": "https://example.com/success",
"cancelUrl": "https://example.com/cancel",
"expiresAt": "1703939166000",
"paymentIntent": "b7c30e83-5439-47b2-ac4d-81c64c1d0174",
"paymentMethodTypes": [
"crypto",
"card"
],
"paymentMethodOptions": {
"crypto": [
{
"currency": {
"value": "usdt",
"name": "Tether",
"logo": "/static/images/cryptos/usdt.png"
},
"networks": [
{
"value": "tron",
"name": "Tron (TRC20)"
}
]
}
],
"card": null
},
"url": "https://buy-dev.payfect.finance/checkouts/ed8d24aa-a860-426b-8e56-87cb9f55a081",
"metadata": null,
"isLivemode": false
}

Example

curl -X GET "https://api.payfect.finance/api/v1/checkouts/ed8d24aa-a860-426b-8e56-87cb9f55a081/" \
-H "Authorization: Api-Key 5a31f3a4-279c-11ee-be56-0242ac120002"