Payment intents
The payment_intent object
A payment intent tracks one payment you want to collect, from creation until it succeeds or is canceled. Confirming it creates a charge through a payment provider; the intent's status follows that charge.
Attributes
idstringRequiredUnique identifier for the object.
objectstringRequiredString naming the object's type.
livemodebooleanRequiredtruewhen the object exists in live mode,falsein test mode.createdtimestampRequiredTime the object was created, in Unix seconds.
updatedtimestampRequiredTime the object last changed, in Unix seconds.
statusenumRequiredWhere the payment intent is in its lifecycle. It is recomputed from the latest charge each time the charge changes.
requires_payment_methodNo payment method is attached yet. New intents start here unless created with a saved payment method.
requires_confirmationA saved payment method is attached; confirm the intent to start the payment.
requires_actionThe payer must complete the steps in
next_action, such as 3-D Secure or scanning a QR code.processingThe provider has the payment and has not reported the outcome yet.
requires_captureThe payment was authorized; capture the intent to collect the funds, or cancel it to release them.
canceledThe intent was canceled, or its charge was canceled, declined or expired. It cannot be used again.
succeededThe payment was collected.
amountintegerRequiredAmount to collect, in the smallest currency unit (for example,
49900is 499.00 THB).amount_receivedintegerRequiredAmount collected, in the smallest currency unit.
0until the intent succeeds, then the amount captured: equal toamount, or less after a partial capture.amount_capturableintegerRequiredAmount you can capture, in the smallest currency unit. It equals
amountwhilestatusisrequires_captureand is0otherwise.currencystringRequiredThree-letter ISO 4217 currency code of
amount, in lowercase.capture_methodenumRequiredHow the payment is captured once authorized. Defaults to
automatic.automaticFunds are captured as soon as the payment is authorized.
manualFunds are only authorized and the intent waits in
requires_captureuntil you capture or cancel it.
confirmation_methodenumRequiredThe confirmation method set when the intent was created. Defaults to
automatic; Paycose stores it but does not change how the intent is confirmed.automaticThe default. Stored only; it does not change how the intent is confirmed.
manualStored only; it does not change how the intent is confirmed.
client_secretstringA secret created with the intent, of the form
<id>_secret_<random>, so it can't be guessed from the ID. Intents created before this format keep<id>_secret. Keep it out of logs and URLs. No Paycose endpoint currently accepts it.customer_idstringID of the customer the payment is for. Omitted when the payer has no customer record.
payment_method_idstringID of the saved payment method attached to the intent. Omitted until one is attached.
payment_method_typestringPayment method type chosen for the payment, such as
cardorpromptpay. Set frompayment_method.typeon create or confirm, or when the payer picks a method on the hosted checkout; omitted until then.descriptionstringAn arbitrary description you set with the update endpoint. Omitted when empty.
receipt_emailstringEmail address the payment receipt is sent to. It is set with the update endpoint or from the email the payer enters on the hosted checkout. Omitted when empty.
receipt_namestringPayer name printed on the receipt, collected on the hosted checkout. Omitted when empty.
billing_detailsobjectNullableBilling details the payer entered on the hosted checkout or payment link page. Omitted until the payer fills them in.
Show child attributes
billing_details.namestringPayer's name, up to 255 characters. Omitted when not given.
Max length 255
billing_details.emailstringPayer's email address. Omitted when not given.
Max length 254 · Format
emailbilling_details.phonestringPayer's phone number, up to 64 characters. Omitted when not given.
Max length 64
billing_details.addressobjectNullablePayer's billing address. Omitted when not given.
Show child attributes
billing_details.address.line1stringFirst line of the address, such as street and house number. Up to 255 characters.
Max length 255
billing_details.address.line2stringSecond line of the address, such as building or unit. Up to 255 characters.
Max length 255
billing_details.address.citystringCity or district. Up to 255 characters.
Max length 255
billing_details.address.statestringState, province or region. Up to 255 characters.
Max length 255
billing_details.address.postal_codestringPostal code. Up to 32 characters.
Max length 32
billing_details.address.countrystringTwo-letter ISO 3166-1 country code, in uppercase.
Pattern
^[A-Z]{2}$
billing_details.business_namestringName of the payer's business, up to 255 characters. Omitted when not given.
Max length 255
billing_details.tax_idobjectNullablePayer's tax ID. Omitted when not given.
Show child attributes
billing_details.tax_id.typestringRequiredType of the tax ID, as a tax ID type code from
GET /tax_id_types. Up to 64 characters.Max length 64
billing_details.tax_id.valuestringRequiredThe tax ID number. Up to 255 characters; checked against the type's format.
Max length 255
customerobjectNullableName, email and ID of the payer. For a payer without a customer record it is built from
receipt_nameandreceipt_email, with a nullid. Omitted when nothing is known about the payer.Show child attributes
customer.idstringRequiredNullableID of the customer. Null when the payer has no customer record.
customer.namestringName of the customer, or the name the payer gave. Omitted when unknown.
customer.emailstringEmail address of the customer, or the email the payer gave. Omitted when unknown.
latest_charge_idstringID of the most recent charge created by confirming the intent. Omitted until the intent is confirmed.
providerstringName of the payment provider processing the payment, such as
stripeoromise. Omitted until the intent is confirmed.application_fee_amountintegerRequiredNullableApplication fee you keep from the payment instead of owing it to the connected account in
transfer_data, in the smallest currency unit. Null when there is no application fee.transfer_dataobjectRequiredNullableThe connected account the payment is for and, when set, the fixed amount owed to it. Null when the intent has no connected destination.
Show child attributes
transfer_data.destinationstringRequiredID of the connected account (
acct_…) the payment is for.transfer_data.amountintegerRequiredNullableFixed amount owed to the connected account, in the smallest currency unit. Null when no fixed amount was set, in which case the connected account is owed the amount less the application fee.
transfer_data.connectedbooleanRequiredTrue when the destination is a connected account paid under Connect: what you owe it and your application fee are recorded on your ledger. False for a legacy destination.
on_behalf_ofstringRequiredNullableID of the connected account (
acct_…) the payment is made on behalf of. Null when not set.transfer_groupstringRequiredNullableA string that groups this payment with related transfers. Null when not set; once set it cannot change.
payment_method_typesarray of stringsPayment method types the payer may choose from, such as
cardorpromptpay. Omitted when every type enabled for your account is allowed.payment_method_providersarray of stringsPayment providers the hosted checkout may use for a payment method that more than one provider offers. Omitted when any provider may be used.
metadataobjectKey-value pairs you attach to the object for your own use. Paycose never reads or changes them.
next_actionarray of objectsSteps the payer must still complete, such as a 3-D Secure redirect or a QR code to scan, taken from the intent's latest charge. Omitted when nothing is needed and always omitted once the intent has succeeded or been canceled.
Show child attributes
next_action.typestringRequiredThe kind of step. It decides which of
url,client_secret,payment_method,qr_dataandqr_image_urlare set.redirectSend the payer to
urlto finish the payment.share_linkSend the hosted payment link in
urlto the customer so they can complete authentication themselves.confirm_inlineShow the card form in your page and confirm the payment with
client_secret.show_qrShow
qr_dataas a QR code, or the image atqr_image_url, for the payer to scan.qrShow
qr_dataas a QR code for the payer to scan.otpAsk the payer for the one-time password their bank sent and submit it to confirm the payment.
next_action.titlestringRequiredShort heading for the step, in English, suitable to show the payer.
next_action.descriptionstringRequiredOne-sentence explanation of the step, in English, suitable to show the payer.
next_action.urlstringFor
redirect, the page to send the payer to: a 3-D Secure page, a wallet's approval page or a banking app link. Forshare_link, a hosted payment page you can send to the customer; the link is valid for 24 hours. Omitted for other types.next_action.client_secretstringFor
confirm_inline, the provider's client secret the card form uses to confirm or authenticate the payment. Forotp, the provider's reference of the payment that the one-time password confirms. Omitted for other types.next_action.payment_methodstringFor
confirm_inlineafter a payment was refused off-session, the provider's payment method to authenticate. Forshow_qr, the QR payment method the code is for, such asalipay,wechat_payorqr_cross_border. Omitted otherwise.next_action.qr_datastringFor
show_qrandqr, the raw QR payload to render as a QR code for the payer to scan. Omitted for other types.next_action.qr_image_urlstringFor
show_qr, a link to the provider's image of the QR code, for when the provider sends no raw payload (such as an Omise PromptPay charge): show the image for the payer to scan. Omitted when the provider sends none.next_action.cryptoobjectNullableShow child attributes
next_action.crypto.networkstringRequirednext_action.crypto.chain_idstringRequirednext_action.crypto.testnetbooleanRequirednext_action.crypto.deposit_addressstringRequirednext_action.crypto.token_currencystringRequirednext_action.crypto.token_contract_addressstringRequirednext_action.crypto.token_amountstringRequirednext_action.crypto.token_unitsintegerRequirednext_action.crypto.token_decimalsintegerRequirednext_action.crypto.exchange_ratestringnext_action.crypto.explorer_urlstringnext_action.crypto.expires_attimestampRequiredUnix timestamp in seconds.
cancellation_reasonstringWhy the intent was canceled.
merchant_canceledwhen you canceled it through the API, an expiry reason such asqr_expiredwhen its charge expired, or the reason reported by the provider. Omitted unlessstatusiscanceled.cancellation_sourcestringWhat canceled the intent:
apifor a cancel request,local_ttlwhen Paycose's expiry window for the payment method ran out, orprovider_webhookandprovider_inquirywhen the provider reported it. Omitted unlessstatusiscanceled.failure_codestringWhy the latest attempt was declined or the intent was canceled, as a code. For a declined card, Stripe's error code (
card_declined,expired_card,incorrect_cvc,incorrect_numberorprocessing_error) whichever provider declined it; otherwise the provider's own code from the charge. Omitted when there is none.failure_messagestringHuman-readable explanation of the failure that caused the cancellation or the latest declined attempt. Omitted when there is none.
expires_attimestampNullableNot set on payment intents in the current API version; the charge carries its own
expires_at.canceled_attimestampNullableTime the intent was canceled, in Unix seconds. Omitted unless
statusiscanceled.The full charge object when you expand
latest_charge; otherwise omitted.last_payment_errorobjectRequiredNullableWhy the latest attempt was declined, as Stripe's
last_payment_error. Set while the intent waits for a new payment method after a declined attempt; null otherwise.Show child attributes
last_payment_error.typestringRequiredKind of error.
card_errorfor a declined card;api_errorfor other payment methods.last_payment_error.codestringRequiredShort machine-readable reason. For a declined card, Stripe's error code whichever provider declined it:
card_declined, orexpired_card,incorrect_cvc,incorrect_numberorprocessing_error; otherwise the provider's own code. Same value as the intent'sfailure_code.last_payment_error.decline_codestringFor a declined card, the issuer's reason in Stripe's terms, such as
generic_decline,insufficient_fundsorlost_card. Omitted for other payment methods.last_payment_error.provider_codestringThe payment provider's own code for the decline, as it sent it, such as Omise's
payment_rejected.last_payment_error.messagestringRequiredExplanation you can show the customer, for example why the card was declined.
last_payment_error.chargestringID of the failed charge (
ch_…) the attempt created.last_payment_error.payment_methodobjectNullableThe payment method that was declined: its
idandtypeand, for a card, itsbrand,issuerandlast4. Read from the declined charge (the intent itself no longer names the method); omitted when that charge used no saved payment method.Show child attributes
last_payment_error.payment_method.idstringRequiredID of the saved payment method (
pm_…) that was declined.last_payment_error.payment_method.typestringRequiredType of the payment method, for example
card.last_payment_error.payment_method.brandstringCard brand, such as
visa. Omitted for other payment methods or when the declined charge is not at hand.last_payment_error.payment_method.issuerstringBank that issued the card, when known. Omitted otherwise.
last_payment_error.payment_method.last4stringLast four digits of the card number. Omitted for other payment methods or when the declined charge is not at hand.
last_payment_error.payment_method_typestringType of payment method that was declined, for example
card.