Skip to Content
Paycose Docs
Charges

Charges

The charge object

A charge is one attempt to collect a payment through a payment provider. Paycose creates a charge when a payment intent is confirmed or a payer pays through Checkout or a payment link, and it records the charge's authorization, capture, fees, refunds, disputes and settlement.

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

    Overall state of the charge, derived from its flags: failed when the provider declined it or canceled is true, succeeded when paid is true, otherwise pending.

    • succeeded

      The payment was completed or authorized. A manual capture charge stays succeeded while it waits to be captured.

    • pending

      The charge is waiting for the payer, the provider or a capture decision.

    • failed

      The charge was canceled, declined or expired and will not complete.

  • customer_idstringRequired

    ID of the customer the charge was made for. Empty when the payer has no customer record.

  • payment_method_idstring

    ID of the saved payment method the charge used. Omitted when the payer paid without a saved payment method.

  • payment_intentstring

    ID of the payment intent that created the charge. Omitted when the charge has no payment intent.

  • amountintegerRequired

    Amount the charge asks the payer for, in the smallest currency unit (for example, 49900 is 499.00 THB).

  • application_fee_amountintegerRequired

    Application fee on the charge, in the smallest currency unit. On a destination charge it is the part of the payment you keep instead of owing it to the connected account. 0 when the charge has no application fee.

  • application_tax_amountintegerRequired

    Tax amount recorded on the charge, in the smallest currency unit. Some charges that collect an invoice carry the invoice's tax here; all other charges show 0.

  • net_amountintegerRequired

    What the charge leaves for its owner after fees, in the smallest currency unit. It is provisional until the charge settles; from then on it is the captured amount less the Paycose fee deducted at settlement. On the memo plane, where your own provider account receives the money and the provider keeps its fee, it is the captured amount less provider_fee_amount, the same as the net of the charge's balance transaction; the Paycose fee is not taken from that money (see gateway_fee_amount). A refund never lowers it: each refund has its own balance transaction.

  • applicationstringRequiredNullable

    ID of your application (app_…) that earned the charge's application fee. Null until an application fee object exists for the charge.

  • application_feestringRequiredNullable

    ID of the application fee object (fee_…) created for the charge. It is created when a destination charge with an application fee settles; null otherwise.

  • on_behalf_ofstringRequiredNullable

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

  • transfer_groupstringRequiredNullable

    The string that groups this charge with related transfers, copied from the payment intent or set when the charge was created. Null when not set.

  • amount_refundedintegerRequired

    Total of the charge's succeeded refunds, in the smallest currency unit.

  • amount_capturedintegerRequired

    Amount actually captured, in the smallest currency unit. It equals amount after a full capture, is lower after a partial capture, and is 0 while the charge is uncaptured.

  • amount_capturableintegerRequired

    Amount you can still capture, in the smallest currency unit. It equals amount while a manual capture charge is paid but not yet captured, canceled or refunded, and is 0 otherwise.

  • amount_voidedintegerRequired

    Uncaptured part of the authorization released back to the payer after a partial capture, in the smallest currency unit. 0 when the full amount was captured.

  • currencystringRequired

    Three-letter ISO 4217 currency code of every amount on the charge, in lowercase.

  • scaling_factorintegerRequired

    Number of smallest currency units in one major unit of currency (for example, 100 for THB), so amount / scaling_factor is the amount in major units.

  • paidbooleanRequired

    true once the payer completed the payment and the provider authorized or collected it.

  • canceledbooleanRequired

    true when the charge was canceled, expired or voided before completing, or voided by the provider after capture. A canceled charge has status failed. A charge the provider declined is not canceled: it has status failed with canceled false, as a declined charge on Stripe.

  • refundedbooleanRequired

    true once the charge's succeeded refunds add up to everything that can be refunded.

  • capturedbooleanRequired

    true once the authorized funds have been captured. A charge with capture_method automatic is captured as soon as it is paid.

  • capture_methodstringRequired

    How the charge is captured: automatic captures the funds when the payment is authorized, manual holds them until you capture the charge.

    • automatic

      Funds are captured as soon as the payment is authorized.

    • manual

      Funds are only authorized; you capture them later with the capture endpoint, or cancel to release them.

  • settlement_statusenumRequired

    Where the charge is in settlement, the step that records its fees and books its funds to your balance.

    • pending

      The charge has not settled yet. A charge that failed never settles and keeps this value.

    • settled

      Fees were recorded and the charge's funds were booked to the right balance.

    • needs_reconcile

      Settlement found a mismatch that needs review, such as fees larger than the captured amount or a missing exchange rate.

  • failure_reasonstring

    Why the charge failed or expired, always one of the values listed here, so you can branch on it. Omitted when the charge has not failed.

    Show 23 possible values
    • qr_expired

      The QR code expired before the payer paid.

    • redirect_expired

      The payer did not finish on the provider's page before it expired.

    • voucher_expired

      The payment voucher expired before it was paid.

    • deeplink_expired

      The banking app link expired before the payer completed the payment.

    • session_expired

      The payment session expired before the payer completed it.

    • link_expired

      The payment link expired before the payer completed it.

    • provider_expired

      The provider reported that the payment expired.

    • provider_canceled

      The provider canceled the payment.

    • provider_reversed

      The provider reversed the payment after it was made.

    • provider_declined

      The provider declined the payment.

    • provider_failed

      The provider reported that the payment failed.

    • customer_canceled

      The payer canceled the payment.

    • merchant_canceled

      You canceled the payment.

    • insufficient_funds

      The payer's account or card did not have enough funds.

    • duplicate

      The payment was refused as a duplicate.

    • fraud_blocked

      The payment was blocked by fraud screening.

    • abandoned

      The payer left without completing the payment.

    • provider_timeout

      The provider did not answer in time.

    • authentication_failed

      The payer failed authentication, such as 3-D Secure.

    • otp_expired

      The one-time password expired before the payer entered it.

    • otp_failed

      The one-time password was wrong or tried too many times.

    • system_error

      An error inside Paycose stopped the payment.

    • unknown

      The cause could not be determined.

  • failure_codestring

    Why the charge failed, as a code. For a card the provider declined, Stripe's error code whichever provider declined it: card_declined, or expired_card, incorrect_cvc, incorrect_number or processing_error; the issuer's reason is in outcome.reason. For any other failure, the provider's own code. Omitted when the provider gave none, as on an expiry.

  • failure_provider_codestring

    The payment provider's own code for the failure, as it sent it (for a card decline, the issuer's decline code when the provider sent one), such as Omise's payment_rejected. Omitted when the provider gave none.

  • failure_messagestring

    Human-readable explanation of the failure. When Paycose maps a provider's refusal, it is the Paycose error catalog message for it, not the provider's raw text. Show it to people, but branch on failure_reason. Omitted when there is none.

  • reason_sourcestring

    What observed the failure or expiry recorded in failure_reason. Omitted when the charge has not failed.

    • provider_webhook

      A notification from the payment provider.

    • provider_inquiry

      A status check Paycose made with the provider.

    • local_ttl

      Paycose's own expiry window for the payment method ran out.

    • api

      A request made through the API.

    • payer

      An action by the payer.

    • system

      Paycose itself.

  • outcomeobjectRequiredNullable

    How the payment network answered the charge, in Stripe's terms: authorized once the charge is paid, or issuer_declined with the issuer's reason when the provider declined a card. Null while the charge is pending and when it failed in another way, such as an expiry.

    Show child attributes
    • outcome.typestringRequired

      authorized when the payment was approved; issuer_declined when the provider declined the card on the issuer's behalf.

      • authorized

        The payment was approved.

      • issuer_declined

        The card's issuer declined the payment.

    • outcome.network_statusstringRequired

      approved_by_network for an authorized charge; declined_by_network for a declined one.

      • approved_by_network

        The payment network approved the payment.

      • declined_by_network

        The payment network declined the payment.

    • outcome.reasonstringRequiredNullable

      For a declined charge, the issuer's reason in Stripe's terms (its decline code), such as generic_decline, insufficient_funds, expired_card or incorrect_cvc. Null for an authorized charge.

    • outcome.seller_messagestringRequired

      A short explanation meant for you, not the payer: Payment complete. for an authorized charge, otherwise which decline code the bank returned.

    • outcome.risk_levelstringRequired
    • outcome.risk_scoreintegerRequiredNullable
    • outcome.rulestringRequiredNullable
  • reviewstringRequiredNullable
  • expires_attimestampNullable

    Time after which an unpaid charge can no longer be paid, in Unix seconds: the provider's own expiry when it gives one, otherwise a window that depends on the payment method. Omitted for charges that were already paid, captured or canceled when they were created.

  • canceled_attimestampNullable

    Time the charge was canceled or expired, in Unix seconds. Omitted while the charge is not canceled, and on a charge the provider declined.

  • disputedbooleanRequired

    true while the charge has a dispute that is open or was lost. It returns to false when the dispute is won.

  • dispute_idstringRequired

    ID of the most recent dispute on the charge. Empty when the charge was never disputed.

  • dispute_statusstringRequired

    Status of the most recent dispute on the charge, the same value as that dispute's status. Empty when the charge was never disputed.

  • dispute_reasonstringRequired

    Reason the provider gave for the most recent dispute on the charge. Empty when the charge was never disputed.

  • dispute_amountintegerRequired

    Amount under dispute in the most recent dispute, in the smallest currency unit. 0 when the charge was never disputed.

  • transfer_dataobjectRequiredNullable

    The connected account the payment is for, and the amount owed to it when a fixed transfer amount was set. Null when the charge has no connected destination.

    Show child attributes
    • transfer_data.destinationstringRequired

      ID of the connected account (acct_…) the charge 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 captured amount less the application fee.

    • transfer_data.balance_idstringRequired

      ID of the balance the charge's funds are booked to. For a connected account this is your own balance in the charge's currency.

  • providerstringRequired

    Name of the payment provider that processed the charge, such as stripe or omise.

  • planestringRequired

    Who holds the charge's money. Empty when it cannot be determined from the provider.

    • custodial

      The payment was processed with Paycose's provider account, so Paycose holds the funds and pays them out to you.

    • memo

      The payment was processed with your own provider account, so the provider pays you directly and Paycose only records the charge.

  • gateway_fee_amountintegerRequired

    The Paycose fee for the charge, in the smallest currency unit, set when the charge settles. It is either deducted from what the charge settles or paid from your prepaid Paycose credit. 0 before settlement.

  • credit_covered_fee_amountintegerRequired

    Part of the application fee that was paid from prepaid credit, in the smallest currency unit. Only older charges carry a value; new charges show 0.

  • provider_fee_amountintegerRequired

    The payment provider's processing fee for the charge, in the smallest currency unit of the charge's currency. 0 until the charge settles.

  • payable_amountintegerRequiredNullable

    Deprecated. What settling the charge credited to your Paycose balance, in the smallest currency unit: the same as net_amount when Paycose holds the funds (plane is custodial), 0 when the money is held by your own provider account (plane is memo), and null before settlement. Like net_amount, a refund never lowers it.

  • reference_idstringRequired

    The payment provider's own identifier for the charge or its payment. Empty until the provider has created it. A declined charge keeps the id of the failed charge the provider created for the attempt, when it created one.

  • metadataobjectRequired

    Key-value pairs stored on the charge. Keys the payment provider or Paycose keep for themselves, such as the receipt link, are left out.

  • receipt_urlstringRequiredNullable

    Link to the payer's receipt page for this charge, from Paycose or the payment provider. Null until a receipt exists.

  • next_actionarray of objects

    Steps the payer must still complete for the charge to be paid, such as a 3-D Secure redirect or a QR code to scan. Omitted once nothing is needed and always omitted after the charge is paid, canceled or refunded.

    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.

  • promptpayobjectNullable

    The QR code for a QR payment (PromptPay and other QR methods). Omitted for other payment methods.

    Show child attributes
    • promptpay.rawstringRequired

      The QR payload (EMVCo format for Thai QR) to render as a QR code for the payer to scan.

    • promptpay.imagestringRequired

      An image of the QR code supplied by the provider, as a URL or encoded image data. Some providers supply none; render the code from raw instead.

    • promptpay.ref1stringRequired

      Reference 1 of a Thai QR payment, up to 20 characters, derived from the charge ID. Empty when the provider's QR carries no references.

    • promptpay.ref2stringRequired

      Reference 2 of a Thai QR payment: the creation time as yyyyMMddHHmmss followed by a 3-character random suffix. Empty when the provider's QR carries no references.

    • promptpay.ref3stringRequired

      Reference 3 of a Thai QR payment: your configured reference code followed by the creation time and a 3-digit random suffix. Empty when the provider's QR carries no references.

    • promptpay.expires_attimestampNullable

      Time after which the QR code can no longer be paid, in Unix seconds. Omitted when unknown.

  • installmentobjectNullable

    The installment plan when the payer chose to pay by card installments with a fixed number of months. Omitted otherwise.

    Show child attributes
    • installment.termintegerRequired

      Number of monthly payments in the plan the payer chose.

    • installment.total_termintegerRequired

      Number of months the payer pays: term, plus the second tier of a two-tier campaign. Equal to term for other plans.

    • installment.issuerstring

      Name of the installment provider whose plan the payer chose, such as krungsri_firstchoice.

    • installment.card_face_idstring

      ID of the card product the payer's card was matched to when choosing the plan. Omitted when none was matched.

    • installment.interest_amountintegerRequired

      Total interest the payer pays over the plan, in the smallest currency unit. 0 when you absorb the interest or the plan is interest-free.

    • installment.absorptionstring

      Who pays the plan's interest. Omitted when not recorded.

      • customer

        The payer pays the interest, which is added to the monthly payments.

      • merchant

        You absorb the interest; the payer pays no interest.

    • installment.monthly_amountintegerRequired

      Each monthly payment, in the smallest currency unit: the charge amount plus interest_amount, divided by total_term and rounded down.

    • installment.first_amountintegerRequired

      The first monthly payment, in the smallest currency unit. It equals monthly_amount plus any remainder left by rounding.

  • customerobject (customer)NullableExpandable

    The full customer object when you expand customer; otherwise omitted.

  • invoicestring | object (invoice)Expandable

    ID of the invoice this charge collects, or the full invoice object when you expand invoice. Omitted when the charge collects no invoice.

  • payment_methodobjectRequiredNullableExpandable

    Summary of the payment method used: its type and, for cards, brand, issuer and last4. When you expand payment_method, the saved payment method's fields are added to this object.

    Show child attributes
    • payment_method.idstring

      ID of the saved payment method used for the charge; omitted when the charge did not use a saved payment method.

    • payment_method.typestringRequired

      Payment method type used for the charge, such as card or promptpay.

    • payment_method.brandstring

      Card brand used for the charge, such as visa; omitted when the charge was not paid by card. When the charge recorded none, the saved payment method's brand is used if you expand payment_method.

    • payment_method.issuerstring

      Bank that issued the card used for the charge; omitted when unknown.

    • payment_method.last4string

      Last four digits of the card used for the charge; omitted when unknown.

    • payment_method.cryptoobjectNullable
      Show child attributes
      • payment_method.crypto.networkstringRequired
      • payment_method.crypto.network_idstringRequired
      • payment_method.crypto.transaction_hashstringRequired
      • payment_method.crypto.buyer_addressstringRequired
      • payment_method.crypto.deposit_addressstring
      • payment_method.crypto.token_currencystringRequired
      • payment_method.crypto.token_amountintegerRequired
      • payment_method.crypto.token_decimalsintegerRequired
      • payment_method.crypto.token_contract_addressstringRequired
      • payment_method.crypto.transaction_urlstring
      • payment_method.crypto.auto_recordedboolean
      • payment_method.crypto.exchange_ratestring
      • payment_method.crypto.fx_quote_idstring
      • payment_method.crypto.received_token_amountinteger
      • payment_method.crypto.overpaid_token_amountinteger
      • payment_method.crypto.fee_collectionstring
      • payment_method.crypto.onchain_fee_amountinteger
    • payment_method.objectstring

      String naming the object's type.

    • payment_method.livemodeboolean

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

    • payment_method.createdtimestamp

      Time the object was created, in Unix seconds.

    • payment_method.updatedtimestamp

      Time the object last changed, in Unix seconds.

    • payment_method.customer_idstring

      ID of the customer that owns the payment method. Included only when you expand payment_method.

    • payment_method.card_holder_namestring

      Name of the cardholder; empty when not provided. Included only when you expand payment_method.

    • payment_method.fingerprintstring

      Identifies the card number: two payment methods for the same card share a fingerprint. Omitted when the payment provider does not report one. Included only when you expand payment_method.

    • payment_method.exp_monthinteger

      Expiration month of the card, 1 to 12; 0 when not applicable. Included only when you expand payment_method.

    • payment_method.exp_yearinteger

      Expiration year of the card; 0 when not applicable. Included only when you expand payment_method.

    • payment_method.cardobjectNullable

      Card details; omitted when the payment method has none. Included only when you expand payment_method.

      Show child attributes
      • payment_method.card.brandstring

        Card brand in lowercase, such as visa or mastercard.

      • payment_method.card.issuerstring

        Bank that issued the card, in lowercase.

      • payment_method.card.last4string

        Last four digits of the card number.

      • payment_method.card.exp_monthinteger

        Expiration month of the card, 1 to 12.

      • payment_method.card.exp_yearinteger

        Expiration year of the card.

    • payment_method.billing_detailsobject

      Billing details collected with the payment method; omitted when none were collected. Included only when you expand payment_method.

    • payment_method.allow_redisplaystring

      Whether the payment method may be offered to the customer again in later payments; omitted when not set. Included only when you expand payment_method.

    • payment_method.reference_idstring

      ID of the payment method at the payment provider that stores it. Included only when you expand payment_method.

    • payment_method.providerstring

      Payment provider that stores the payment method, such as stripe or omise. Included only when you expand payment_method.

    • payment_method.metadataobject

      Key-value pairs attached to the payment method. Paycose may add customer_reference_id, the customer's ID at the payment provider. Included only when you expand payment_method.

    • payment_method.customerobject (customer)Nullable

      The full customer object when you expand payment_method.customer; otherwise omitted.

    • payment_method.provider_connection_statusstring

      Status of the payment provider account that stores the payment method. Not returned on charges.

      • active

        The provider account is in use.

      • staged

        The provider account is set up but has no credentials in place yet.

      • retired

        The provider account was removed from routing; payment methods it stores can still be used.

      • purged

        The provider account was deleted together with its credentials.

      • missing

        The provider account no longer exists.

    • payment_method.needs_recollectionboolean

      Whether the customer has to add the payment method again. Not returned on charges.

  • balanceobjectNullableExpandable

    Reserved for the balance the charge is credited to. It is not returned in the current API version.

    Show child attributes
    • balance.idstringRequired

      Unique identifier for the object.

    • balance.objectstringRequired

      String naming the object's type.

    • balance.livemodebooleanRequired

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

    • balance.createdtimestampRequired

      Time the object was created, in Unix seconds.

    • balance.updatedtimestampRequired

      Time the object last changed, in Unix seconds.

    • balance.accountstring

      ID of the account (acct_…) that owns the balance. Omitted when the balance has no account.

    • balance.currencystringRequired

      Three-letter ISO 4217 currency code, in lowercase.

    • balance.namestring

      Name of the balance. Omitted when it has none.

    • balance.availableintegerRequired

      Funds available now, in the smallest currency unit.

    • balance.holdintegerRequired

      Funds that are pending or on hold and not yet available, in the smallest currency unit.

    • balance.scaling_factorintegerRequired

      Number of smallest currency units in one major unit of currency (for example, 100 for THB), so available / scaling_factor is the amount in major units.

    • balance.descriptionstringRequired

      Free-text description of the balance.