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
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.
statusenumRequiredOverall state of the charge, derived from its flags:
failedwhen the provider declined it orcanceledistrue,succeededwhenpaidistrue, otherwisepending.succeededThe payment was completed or authorized. A
manualcapture charge stayssucceededwhile it waits to be captured.pendingThe charge is waiting for the payer, the provider or a capture decision.
failedThe charge was canceled, declined or expired and will not complete.
customer_idstringRequiredID of the customer the charge was made for. Empty when the payer has no customer record.
payment_method_idstringID of the saved payment method the charge used. Omitted when the payer paid without a saved payment method.
payment_intentstringID of the payment intent that created the charge. Omitted when the charge has no payment intent.
amountintegerRequiredAmount the charge asks the payer for, in the smallest currency unit (for example,
49900is 499.00 THB).application_fee_amountintegerRequiredApplication 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.
0when the charge has no application fee.application_tax_amountintegerRequiredTax 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_amountintegerRequiredWhat 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 (seegateway_fee_amount). A refund never lowers it: each refund has its own balance transaction.applicationstringRequiredNullableID of your application (
app_…) that earned the charge's application fee. Null until an application fee object exists for the charge.application_feestringRequiredNullableID 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_ofstringRequiredNullableID of the connected account (
acct_…) the charge was made on behalf of. Null when not set.transfer_groupstringRequiredNullableThe 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_refundedintegerRequiredTotal of the charge's succeeded refunds, in the smallest currency unit.
amount_capturedintegerRequiredAmount actually captured, in the smallest currency unit. It equals
amountafter a full capture, is lower after a partial capture, and is0while the charge is uncaptured.amount_capturableintegerRequiredAmount you can still capture, in the smallest currency unit. It equals
amountwhile amanualcapture charge is paid but not yet captured, canceled or refunded, and is0otherwise.amount_voidedintegerRequiredUncaptured part of the authorization released back to the payer after a partial capture, in the smallest currency unit.
0when the full amount was captured.currencystringRequiredThree-letter ISO 4217 currency code of every amount on the charge, in lowercase.
scaling_factorintegerRequiredNumber of smallest currency units in one major unit of
currency(for example,100for THB), soamount / scaling_factoris the amount in major units.paidbooleanRequiredtrueonce the payer completed the payment and the provider authorized or collected it.canceledbooleanRequiredtruewhen the charge was canceled, expired or voided before completing, or voided by the provider after capture. A canceled charge hasstatusfailed. A charge the provider declined is not canceled: it hasstatusfailedwithcanceledfalse, as a declined charge on Stripe.refundedbooleanRequiredtrueonce the charge's succeeded refunds add up to everything that can be refunded.capturedbooleanRequiredtrueonce the authorized funds have been captured. A charge withcapture_methodautomaticis captured as soon as it is paid.capture_methodstringRequiredHow the charge is captured:
automaticcaptures the funds when the payment is authorized,manualholds them until you capture the charge.automaticFunds are captured as soon as the payment is authorized.
manualFunds are only authorized; you capture them later with the capture endpoint, or cancel to release them.
settlement_statusenumRequiredWhere the charge is in settlement, the step that records its fees and books its funds to your balance.
pendingThe charge has not settled yet. A charge that failed never settles and keeps this value.
settledFees were recorded and the charge's funds were booked to the right balance.
needs_reconcileSettlement found a mismatch that needs review, such as fees larger than the captured amount or a missing exchange rate.
failure_reasonstringWhy 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_expiredThe QR code expired before the payer paid.
redirect_expiredThe payer did not finish on the provider's page before it expired.
voucher_expiredThe payment voucher expired before it was paid.
deeplink_expiredThe banking app link expired before the payer completed the payment.
session_expiredThe payment session expired before the payer completed it.
link_expiredThe payment link expired before the payer completed it.
provider_expiredThe provider reported that the payment expired.
provider_canceledThe provider canceled the payment.
provider_reversedThe provider reversed the payment after it was made.
provider_declinedThe provider declined the payment.
provider_failedThe provider reported that the payment failed.
customer_canceledThe payer canceled the payment.
merchant_canceledYou canceled the payment.
insufficient_fundsThe payer's account or card did not have enough funds.
duplicateThe payment was refused as a duplicate.
fraud_blockedThe payment was blocked by fraud screening.
abandonedThe payer left without completing the payment.
provider_timeoutThe provider did not answer in time.
authentication_failedThe payer failed authentication, such as 3-D Secure.
otp_expiredThe one-time password expired before the payer entered it.
otp_failedThe one-time password was wrong or tried too many times.
system_errorAn error inside Paycose stopped the payment.
unknownThe cause could not be determined.
failure_codestringWhy the charge failed, as a code. For a card the provider declined, Stripe's error code whichever provider declined it:
card_declined, orexpired_card,incorrect_cvc,incorrect_numberorprocessing_error; the issuer's reason is inoutcome.reason. For any other failure, the provider's own code. Omitted when the provider gave none, as on an expiry.failure_provider_codestringThe 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_messagestringHuman-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_sourcestringWhat observed the failure or expiry recorded in
failure_reason. Omitted when the charge has not failed.provider_webhookA notification from the payment provider.
provider_inquiryA status check Paycose made with the provider.
local_ttlPaycose's own expiry window for the payment method ran out.
apiA request made through the API.
payerAn action by the payer.
systemPaycose itself.
outcomeobjectRequiredNullableHow the payment network answered the charge, in Stripe's terms:
authorizedonce the charge is paid, orissuer_declinedwith 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.typestringRequiredauthorizedwhen the payment was approved;issuer_declinedwhen the provider declined the card on the issuer's behalf.authorizedThe payment was approved.
issuer_declinedThe card's issuer declined the payment.
outcome.network_statusstringRequiredapproved_by_networkfor an authorized charge;declined_by_networkfor a declined one.approved_by_networkThe payment network approved the payment.
declined_by_networkThe payment network declined the payment.
outcome.reasonstringRequiredNullableFor a declined charge, the issuer's reason in Stripe's terms (its decline code), such as
generic_decline,insufficient_funds,expired_cardorincorrect_cvc. Null for an authorized charge.outcome.seller_messagestringRequiredA short explanation meant for you, not the payer:
Payment complete.for an authorized charge, otherwise which decline code the bank returned.outcome.risk_levelstringRequiredoutcome.risk_scoreintegerRequiredNullableoutcome.rulestringRequiredNullable
reviewstringRequiredNullableexpires_attimestampNullableTime 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_attimestampNullableTime the charge was canceled or expired, in Unix seconds. Omitted while the charge is not canceled, and on a charge the provider declined.
disputedbooleanRequiredtruewhile the charge has a dispute that is open or was lost. It returns tofalsewhen the dispute is won.dispute_idstringRequiredID of the most recent dispute on the charge. Empty when the charge was never disputed.
dispute_statusstringRequiredStatus of the most recent dispute on the charge, the same value as that dispute's
status. Empty when the charge was never disputed.dispute_reasonstringRequiredReason the provider gave for the most recent dispute on the charge. Empty when the charge was never disputed.
dispute_amountintegerRequiredAmount under dispute in the most recent dispute, in the smallest currency unit.
0when the charge was never disputed.transfer_dataobjectRequiredNullableThe 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.destinationstringRequiredID of the connected account (
acct_…) the charge 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 captured amount less the application fee.
transfer_data.balance_idstringRequiredID of the balance the charge's funds are booked to. For a connected account this is your own balance in the charge's currency.
providerstringRequiredName of the payment provider that processed the charge, such as
stripeoromise.planestringRequiredWho holds the charge's money. Empty when it cannot be determined from the provider.
custodialThe payment was processed with Paycose's provider account, so Paycose holds the funds and pays them out to you.
memoThe payment was processed with your own provider account, so the provider pays you directly and Paycose only records the charge.
gateway_fee_amountintegerRequiredThe 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.
0before settlement.credit_covered_fee_amountintegerRequiredPart 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_amountintegerRequiredThe payment provider's processing fee for the charge, in the smallest currency unit of the charge's currency.
0until the charge settles.payable_amountintegerRequiredNullableDeprecated. What settling the charge credited to your Paycose balance, in the smallest currency unit: the same as
net_amountwhen Paycose holds the funds (planeiscustodial),0when the money is held by your own provider account (planeismemo), andnullbefore settlement. Likenet_amount, a refund never lowers it.reference_idstringRequiredThe 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.
metadataobjectRequiredKey-value pairs stored on the charge. Keys the payment provider or Paycose keep for themselves, such as the receipt link, are left out.
receipt_urlstringRequiredNullableLink to the payer's receipt page for this charge, from Paycose or the payment provider. Null until a receipt exists.
next_actionarray of objectsSteps 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.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.
promptpayobjectNullableThe QR code for a QR payment (PromptPay and other QR methods). Omitted for other payment methods.
Show child attributes
promptpay.rawstringRequiredThe QR payload (EMVCo format for Thai QR) to render as a QR code for the payer to scan.
promptpay.imagestringRequiredAn image of the QR code supplied by the provider, as a URL or encoded image data. Some providers supply none; render the code from
rawinstead.promptpay.ref1stringRequiredReference 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.ref2stringRequiredReference 2 of a Thai QR payment: the creation time as
yyyyMMddHHmmssfollowed by a 3-character random suffix. Empty when the provider's QR carries no references.promptpay.ref3stringRequiredReference 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_attimestampNullableTime after which the QR code can no longer be paid, in Unix seconds. Omitted when unknown.
installmentobjectNullableThe installment plan when the payer chose to pay by card installments with a fixed number of months. Omitted otherwise.
Show child attributes
installment.termintegerRequiredNumber of monthly payments in the plan the payer chose.
installment.total_termintegerRequiredNumber of months the payer pays:
term, plus the second tier of a two-tier campaign. Equal totermfor other plans.installment.issuerstringName of the installment provider whose plan the payer chose, such as
krungsri_firstchoice.installment.card_face_idstringID of the card product the payer's card was matched to when choosing the plan. Omitted when none was matched.
installment.interest_amountintegerRequiredTotal interest the payer pays over the plan, in the smallest currency unit.
0when you absorb the interest or the plan is interest-free.installment.absorptionstringWho pays the plan's interest. Omitted when not recorded.
customerThe payer pays the interest, which is added to the monthly payments.
merchantYou absorb the interest; the payer pays no interest.
installment.monthly_amountintegerRequiredEach monthly payment, in the smallest currency unit: the charge amount plus
interest_amount, divided bytotal_termand rounded down.installment.first_amountintegerRequiredThe first monthly payment, in the smallest currency unit. It equals
monthly_amountplus any remainder left by rounding.
The full customer object when you expand
customer; otherwise omitted.ID of the invoice this charge collects, or the full invoice object when you expand
invoice. Omitted when the charge collects no invoice.Summary of the payment method used: its
typeand, for cards,brand,issuerandlast4. When you expandpayment_method, the saved payment method's fields are added to this object.Show child attributes
payment_method.idstringID of the saved payment method used for the charge; omitted when the charge did not use a saved payment method.
payment_method.typestringRequiredPayment method type used for the charge, such as
cardorpromptpay.payment_method.brandstringCard 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 expandpayment_method.payment_method.issuerstringBank that issued the card used for the charge; omitted when unknown.
payment_method.last4stringLast four digits of the card used for the charge; omitted when unknown.
payment_method.cryptoobjectNullableShow child attributes
payment_method.crypto.networkstringRequiredpayment_method.crypto.network_idstringRequiredpayment_method.crypto.transaction_hashstringRequiredpayment_method.crypto.buyer_addressstringRequiredpayment_method.crypto.deposit_addressstringpayment_method.crypto.token_currencystringRequiredpayment_method.crypto.token_amountintegerRequiredpayment_method.crypto.token_decimalsintegerRequiredpayment_method.crypto.token_contract_addressstringRequiredpayment_method.crypto.transaction_urlstringpayment_method.crypto.auto_recordedbooleanpayment_method.crypto.exchange_ratestringpayment_method.crypto.fx_quote_idstringpayment_method.crypto.received_token_amountintegerpayment_method.crypto.overpaid_token_amountintegerpayment_method.crypto.fee_collectionstringpayment_method.crypto.onchain_fee_amountinteger
payment_method.objectstringString naming the object's type.
payment_method.livemodebooleantruewhen the object exists in live mode,falsein test mode.payment_method.createdtimestampTime the object was created, in Unix seconds.
payment_method.updatedtimestampTime the object last changed, in Unix seconds.
payment_method.customer_idstringID of the customer that owns the payment method. Included only when you expand
payment_method.payment_method.card_holder_namestringName of the cardholder; empty when not provided. Included only when you expand
payment_method.payment_method.fingerprintstringIdentifies 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_monthintegerExpiration month of the card, 1 to 12;
0when not applicable. Included only when you expandpayment_method.payment_method.exp_yearintegerExpiration year of the card;
0when not applicable. Included only when you expandpayment_method.payment_method.cardobjectNullableCard details; omitted when the payment method has none. Included only when you expand
payment_method.Show child attributes
payment_method.card.brandstringCard brand in lowercase, such as
visaormastercard.payment_method.card.issuerstringBank that issued the card, in lowercase.
payment_method.card.last4stringLast four digits of the card number.
payment_method.card.exp_monthintegerExpiration month of the card, 1 to 12.
payment_method.card.exp_yearintegerExpiration year of the card.
payment_method.billing_detailsobjectBilling details collected with the payment method; omitted when none were collected. Included only when you expand
payment_method.payment_method.allow_redisplaystringWhether 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_idstringID of the payment method at the payment provider that stores it. Included only when you expand
payment_method.payment_method.providerstringPayment provider that stores the payment method, such as
stripeoromise. Included only when you expandpayment_method.payment_method.metadataobjectKey-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 expandpayment_method.The full customer object when you expand
payment_method.customer; otherwise omitted.payment_method.provider_connection_statusstringStatus of the payment provider account that stores the payment method. Not returned on charges.
activeThe provider account is in use.
stagedThe provider account is set up but has no credentials in place yet.
retiredThe provider account was removed from routing; payment methods it stores can still be used.
purgedThe provider account was deleted together with its credentials.
missingThe provider account no longer exists.
payment_method.needs_recollectionbooleanWhether the customer has to add the payment method again. Not returned on charges.
Reserved for the balance the charge is credited to. It is not returned in the current API version.
Show child attributes
balance.idstringRequiredUnique identifier for the object.
balance.objectstringRequiredString naming the object's type.
balance.livemodebooleanRequiredtruewhen the object exists in live mode,falsein test mode.balance.createdtimestampRequiredTime the object was created, in Unix seconds.
balance.updatedtimestampRequiredTime the object last changed, in Unix seconds.
balance.accountstringID of the account (
acct_…) that owns the balance. Omitted when the balance has no account.balance.currencystringRequiredThree-letter ISO 4217 currency code, in lowercase.
balance.namestringName of the balance. Omitted when it has none.
balance.availableintegerRequiredFunds available now, in the smallest currency unit.
balance.holdintegerRequiredFunds that are pending or on hold and not yet available, in the smallest currency unit.
balance.scaling_factorintegerRequiredNumber of smallest currency units in one major unit of
currency(for example,100for THB), soavailable / scaling_factoris the amount in major units.balance.descriptionstringRequiredFree-text description of the balance.