Skip to Content
Paycose Docs
Payment intents

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

  • idstringRequired

    Unique identifier for the object.

  • objectstringRequired

    String naming the object's type.

  • livemodebooleanRequired

    true when the object exists in live mode, false in test mode.

  • createdtimestampRequired

    Time the object was created, in Unix seconds.

  • updatedtimestampRequired

    Time the object last changed, in Unix seconds.

  • statusenumRequired

    Where the payment intent is in its lifecycle. It is recomputed from the latest charge each time the charge changes.

    • requires_payment_method

      No payment method is attached yet. New intents start here unless created with a saved payment method.

    • requires_confirmation

      A saved payment method is attached; confirm the intent to start the payment.

    • requires_action

      The payer must complete the steps in next_action, such as 3-D Secure or scanning a QR code.

    • processing

      The provider has the payment and has not reported the outcome yet.

    • requires_capture

      The payment was authorized; capture the intent to collect the funds, or cancel it to release them.

    • canceled

      The intent was canceled, or its charge was canceled, declined or expired. It cannot be used again.

    • succeeded

      The payment was collected.

  • amountintegerRequired

    Amount to collect, in the smallest currency unit (for example, 49900 is 499.00 THB).

  • amount_receivedintegerRequired

    Amount collected, in the smallest currency unit. 0 until the intent succeeds, then the amount captured: equal to amount, or less after a partial capture.

  • amount_capturableintegerRequired

    Amount you can capture, in the smallest currency unit. It equals amount while status is requires_capture and is 0 otherwise.

  • currencystringRequired

    Three-letter ISO 4217 currency code of amount, in lowercase.

  • capture_methodenumRequired

    How the payment is captured once authorized. Defaults to automatic.

    • automatic

      Funds are captured as soon as the payment is authorized.

    • manual

      Funds are only authorized and the intent waits in requires_capture until you capture or cancel it.

  • confirmation_methodenumRequired

    The confirmation method set when the intent was created. Defaults to automatic; Paycose stores it but does not change how the intent is confirmed.

    • automatic

      The default. Stored only; it does not change how the intent is confirmed.

    • manual

      Stored only; it does not change how the intent is confirmed.

  • client_secretstring

    A 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_idstring

    ID of the customer the payment is for. Omitted when the payer has no customer record.

  • payment_method_idstring

    ID of the saved payment method attached to the intent. Omitted until one is attached.

  • payment_method_typestring

    Payment method type chosen for the payment, such as card or promptpay. Set from payment_method.type on create or confirm, or when the payer picks a method on the hosted checkout; omitted until then.

  • descriptionstring

    An arbitrary description you set with the update endpoint. Omitted when empty.

  • receipt_emailstring

    Email 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_namestring

    Payer name printed on the receipt, collected on the hosted checkout. Omitted when empty.

  • billing_detailsobjectNullable

    Billing details the payer entered on the hosted checkout or payment link page. Omitted until the payer fills them in.

    Show child attributes
    • billing_details.namestring

      Payer's name, up to 255 characters. Omitted when not given.

      Max length 255

    • billing_details.emailstring

      Payer's email address. Omitted when not given.

      Max length 254 · Format email

    • billing_details.phonestring

      Payer's phone number, up to 64 characters. Omitted when not given.

      Max length 64

    • billing_details.addressobjectNullable

      Payer's billing address. Omitted when not given.

      Show child attributes
      • billing_details.address.line1string

        First line of the address, such as street and house number. Up to 255 characters.

        Max length 255

      • billing_details.address.line2string

        Second line of the address, such as building or unit. Up to 255 characters.

        Max length 255

      • billing_details.address.citystring

        City or district. Up to 255 characters.

        Max length 255

      • billing_details.address.statestring

        State, province or region. Up to 255 characters.

        Max length 255

      • billing_details.address.postal_codestring

        Postal code. Up to 32 characters.

        Max length 32

      • billing_details.address.countrystring

        Two-letter ISO 3166-1 country code, in uppercase.

        Pattern ^[A-Z]{2}$

    • billing_details.business_namestring

      Name of the payer's business, up to 255 characters. Omitted when not given.

      Max length 255

    • billing_details.tax_idobjectNullable

      Payer's tax ID. Omitted when not given.

      Show child attributes
      • billing_details.tax_id.typestringRequired

        Type 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.valuestringRequired

        The tax ID number. Up to 255 characters; checked against the type's format.

        Max length 255

  • customerobjectNullable

    Name, email and ID of the payer. For a payer without a customer record it is built from receipt_name and receipt_email, with a null id. Omitted when nothing is known about the payer.

    Show child attributes
    • customer.idstringRequiredNullable

      ID of the customer. Null when the payer has no customer record.

    • customer.namestring

      Name of the customer, or the name the payer gave. Omitted when unknown.

    • customer.emailstring

      Email address of the customer, or the email the payer gave. Omitted when unknown.

  • latest_charge_idstring

    ID of the most recent charge created by confirming the intent. Omitted until the intent is confirmed.

  • providerstring

    Name of the payment provider processing the payment, such as stripe or omise. Omitted until the intent is confirmed.

  • application_fee_amountintegerRequiredNullable

    Application 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_dataobjectRequiredNullable

    The 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.destinationstringRequired

      ID of the connected account (acct_…) the payment is for.

    • transfer_data.amountintegerRequiredNullable

      Fixed 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.connectedbooleanRequired

      True 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_ofstringRequiredNullable

    ID of the connected account (acct_…) the payment is made on behalf of. Null when not set.

  • transfer_groupstringRequiredNullable

    A string that groups this payment with related transfers. Null when not set; once set it cannot change.

  • payment_method_typesarray of strings

    Payment method types the payer may choose from, such as card or promptpay. Omitted when every type enabled for your account is allowed.

  • payment_method_providersarray of strings

    Payment providers the hosted checkout may use for a payment method that more than one provider offers. Omitted when any provider may be used.

  • metadataobject

    Key-value pairs you attach to the object for your own use. Paycose never reads or changes them.

  • next_actionarray of objects

    Steps 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.typestringRequired

      The kind of step. It decides which of url, client_secret, payment_method, qr_data and qr_image_url are set.

      • redirect

        Send the payer to url to finish the payment.

      • share_link

        Send the hosted payment link in url to the customer so they can complete authentication themselves.

      • confirm_inline

        Show the card form in your page and confirm the payment with client_secret.

      • show_qr

        Show qr_data as a QR code, or the image at qr_image_url, for the payer to scan.

      • qr

        Show qr_data as a QR code for the payer to scan.

      • otp

        Ask the payer for the one-time password their bank sent and submit it to confirm the payment.

    • next_action.titlestringRequired

      Short heading for the step, in English, suitable to show the payer.

    • next_action.descriptionstringRequired

      One-sentence explanation of the step, in English, suitable to show the payer.

    • next_action.urlstring

      For redirect, the page to send the payer to: a 3-D Secure page, a wallet's approval page or a banking app link. For share_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_secretstring

      For confirm_inline, the provider's client secret the card form uses to confirm or authenticate the payment. For otp, the provider's reference of the payment that the one-time password confirms. Omitted for other types.

    • next_action.payment_methodstring

      For confirm_inline after a payment was refused off-session, the provider's payment method to authenticate. For show_qr, the QR payment method the code is for, such as alipay, wechat_pay or qr_cross_border. Omitted otherwise.

    • next_action.qr_datastring

      For show_qr and qr, the raw QR payload to render as a QR code for the payer to scan. Omitted for other types.

    • next_action.qr_image_urlstring

      For 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.cryptoobjectNullable
      Show child attributes
      • next_action.crypto.networkstringRequired
      • next_action.crypto.chain_idstringRequired
      • next_action.crypto.testnetbooleanRequired
      • next_action.crypto.deposit_addressstringRequired
      • next_action.crypto.token_currencystringRequired
      • next_action.crypto.token_contract_addressstringRequired
      • next_action.crypto.token_amountstringRequired
      • next_action.crypto.token_unitsintegerRequired
      • next_action.crypto.token_decimalsintegerRequired
      • next_action.crypto.exchange_ratestring
      • next_action.crypto.explorer_urlstring
      • next_action.crypto.expires_attimestampRequired

        Unix timestamp in seconds.

  • cancellation_reasonstring

    Why the intent was canceled. merchant_canceled when you canceled it through the API, an expiry reason such as qr_expired when its charge expired, or the reason reported by the provider. Omitted unless status is canceled.

  • cancellation_sourcestring

    What canceled the intent: api for a cancel request, local_ttl when Paycose's expiry window for the payment method ran out, or provider_webhook and provider_inquiry when the provider reported it. Omitted unless status is canceled.

  • failure_codestring

    Why 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_number or processing_error) whichever provider declined it; otherwise the provider's own code from the charge. Omitted when there is none.

  • failure_messagestring

    Human-readable explanation of the failure that caused the cancellation or the latest declined attempt. Omitted when there is none.

  • expires_attimestampNullable

    Not set on payment intents in the current API version; the charge carries its own expires_at.

  • canceled_attimestampNullable

    Time the intent was canceled, in Unix seconds. Omitted unless status is canceled.

  • latest_chargeobject (charge)NullableExpandable

    The full charge object when you expand latest_charge; otherwise omitted.

  • last_payment_errorobjectRequiredNullable

    Why 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.typestringRequired

      Kind of error. card_error for a declined card; api_error for other payment methods.

    • last_payment_error.codestringRequired

      Short machine-readable reason. For a declined card, Stripe's error code whichever provider declined it: card_declined, or expired_card, incorrect_cvc, incorrect_number or processing_error; otherwise the provider's own code. Same value as the intent's failure_code.

    • last_payment_error.decline_codestring

      For a declined card, the issuer's reason in Stripe's terms, such as generic_decline, insufficient_funds or lost_card. Omitted for other payment methods.

    • last_payment_error.provider_codestring

      The payment provider's own code for the decline, as it sent it, such as Omise's payment_rejected.

    • last_payment_error.messagestringRequired

      Explanation you can show the customer, for example why the card was declined.

    • last_payment_error.chargestring

      ID of the failed charge (ch_…) the attempt created.

    • last_payment_error.payment_methodobjectNullable

      The payment method that was declined: its id and type and, for a card, its brand, issuer and last4. 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.idstringRequired

        ID of the saved payment method (pm_…) that was declined.

      • last_payment_error.payment_method.typestringRequired

        Type of the payment method, for example card.

      • last_payment_error.payment_method.brandstring

        Card brand, such as visa. Omitted for other payment methods or when the declined charge is not at hand.

      • last_payment_error.payment_method.issuerstring

        Bank that issued the card, when known. Omitted otherwise.

      • last_payment_error.payment_method.last4string

        Last 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_typestring

      Type of payment method that was declined, for example card.