Pay order by token or Alipay/WeChat Pay
Pay an order without its link, by shared payment token or Alipay/WeChat Pay (method alipay_wechat_pay).
Token: only if payment.handlers isn't empty and you can request one from the user's Link wallet (US and Canadian accounts); never ask the user for one. First show the user the USD total, the stay and every term (meals, cancellation, fees payable at the property), ask them to confirm and wait for a clear yes. Token: request it with config.business_profile and payment.credentialLimits; pass it with price.total. Wallet: pass method, price.total; show payment.wallets (WeChat code as an image if you can, both links); they pay once by either; a code lasts 120 minutes; then the WeChat link opens a new one, or call again. Pay one way only: payment.url or pay_order. On success payment.url stops working; on failure it stays open. Then poll get_order. payment_total_changed: confirm details.total, retry. payment_credential_invalid: new token. service_unavailable: retry. Else payment.url. A token pays one order only.
pay_order · Pays an order · CLI: fortrip orders pay
Input
orderIdstringrequiredThe orderId of the order to pay.matches ^ord_[0-9A-Za-z]{20}$
sharedPaymentTokenstringThe shared payment token (spt_…) the user approved for this order, requested with the order's payment.credentialLimits. Exactly one of sharedPaymentToken, payment and method.matches ^spt_[A-Za-z0-9]{1,250}$
paymentobjectUCP's Complete Checkout payment, in place of sharedPaymentToken: the token as the stripe_payment_token credential of the one selected stripe_payments card instrument. Exactly one of sharedPaymentToken, payment and method.
payment.instrumentsobject[]requiredThe instruments, exactly one of them selected.1–8 items
payment.instruments[].idstringrequiredThe instrument's id, as the agent's UCP client names it.≥ 1 chars
payment.instruments[].handler_idstringrequiredThe id of the handler the instrument pays through: the order's stripe_payments for the selected one.≥ 1 chars
payment.instruments[].typestringrequiredThe instrument type: card for the selected one. A Link token is presented as a card instrument, whatever Link funds it with.≥ 1 chars
payment.instruments[].selectedbooleanWhether this is the instrument to pay with. Exactly one is selected; a lone instrument without it is the one.
payment.instruments[].credentialobjectThe instrument's credential: for the selected one, the shared payment token.
payment.instruments[].credential.typestringrequiredThe credential type: stripe_payment_token for the selected one.≥ 1 chars
payment.instruments[].credential.tokenstringThe shared payment token (spt_…) the user approved for this order, requested with the order's payment.credentialLimits.
payment.instruments[].displayobjectHow the wallet shows the instrument, as UCP has it. Not used to pay.
method"alipay_wechat_pay"Pay with Alipay or WeChat Pay instead of a token: opens the payment and returns payment.wallets. Exactly one of sharedPaymentToken, payment and method.
totalobjectrequiredThe total the user approved: the order's price.total, exactly as returned.
total.amountstringrequiredDecimal string such as 132.40, never a number.matches ^\d+(\.\d+)?$
total.currency"USD"requiredAlways USD in a request.
Output
structuredContent is the Order (pay) object. When the answer holds a live WeChat Pay code, content[0] is the WeChat Pay code as a PNG image, and content[1] is the answer as compact text, unless the image couldn't be fetched; otherwise content[0] is the answer as compact text. Find the blocks by type, not by position. Errors are described in the overview.