Refunds
The refund object
A refund returns all or part of a captured charge to the payer's original payment method. You create one with POST /refunds; refunds made directly at the provider also appear here once Paycose learns about them.
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.
numberstringRequiredSequential refund number assigned when the refund is created, for display on documents and statements.
charge_idstringRequiredID of the charge this refund returns money from.
payment_intentstringID of the payment intent the refunded charge belongs to. Omitted when the charge has no payment intent.
amount_from_merchantintegerRequiredPart of
amounttaken back from what you received for the charge, in the smallest currency unit.0until the refund's balance entries are posted.amount_from_appintegerRequiredPart of
amountcovered by the fees and tax collected on the charge, in the smallest currency unit.0until the refund's balance entries are posted, and0when you fund the whole refund.amountintegerRequiredAmount refunded to the payer, in the smallest currency unit (for example,
49900is 499.00 THB). Always in the charge's currency.currencystringRequiredThree-letter ISO 4217 currency code, 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.statusenumRequiredWhere the refund is in its lifecycle. A refund is sent to the provider when it is created, so it usually leaves
pendingwithin the create call.pendingThe refund was created and is waiting for the provider's final answer. It also stays
pendingwhile its outcome is unknown, until Paycose confirms it with the provider.requires_actionThe provider needs further action before it can complete the refund. Only a refund in this status can be canceled.
succeededThe provider completed the refund. It can still move to
failedif the provider later reports that it failed.failedThe provider declined the refund or could not be reached.
failure_reasonsays why, and any amount already taken from your balance is returned.canceledThe refund was canceled before it completed, through the cancel endpoint or by the provider.
rejectedLegacy status of refunds rejected under an earlier approval flow. New refunds never get it.
reasonstringRequiredWhy the refund was made:
duplicate,fraudulentorrequested_by_customer. Empty when no reason was given, including refunds made directly at the provider.duplicateThe charge was a duplicate.
fraudulentThe charge was fraudulent.
requested_by_customerThe customer asked for the refund.
rejection_reasonstringWhy an older refund was rejected or canceled automatically under an earlier approval flow. Omitted on all other refunds.
failure_reasonstringRequiredNullableWhy a
failedorcanceledrefund did not complete:provider_unavailablewhen the provider could not be reached,declinedwhen it refused without a code, or the provider's own error code (up to 64 characters). Null otherwise.balance_transactionstringRequiredNullableID of the balance transaction that took the refund from your balance. Null until the refund's balance entries are posted.
failure_balance_transactionstringRequiredNullableID of the balance transaction that returned the refunded amount to your balance after the refund failed or was canceled. Null otherwise.
destinationenumRequiredWhere the refunded money goes. Every new refund uses
source;walletappears only on older refunds.walletLegacy. The money was credited to the customer's balance; no longer accepted for new refunds.
sourceThe money goes back to the payer's original payment method.
idempotency_keystringRequiredThe
Idempotency-Keyheader sent with the create request, or a key Paycose generated when none was sent. Retrying the create with the same key returns this refund instead of opening another.requested_attimestampRequiredNullableTime the refund was created, in Unix seconds.
processed_attimestampRequiredNullableTime the refund reached a final status (
succeeded,failed,canceledorrejected), in Unix seconds. Null while it is stillpendingorrequires_action.providerstringRequiredName of the payment provider that processed the refund, the same provider as the original charge.
reference_idstringRequiredThe provider's own identifier for the refund. Empty until the provider has accepted the refund.
metadataobjectRequiredKey-value pairs you attach to the object for your own use. Paycose never reads or changes them.
The full charge object when you expand
charge; otherwise omitted.refund_application_feebooleanRequiredtruewhen the refund was created withrefund_application_fee, so the matching share of the charge's application fee is returned as well.reverse_transferbooleanRequiredThe
reverse_transferoption the refund was created with. The option is no longer applied, so new refunds always showfalse.application_fee_refundstringRequiredNullableID of the application fee refund created when a refund with
refund_application_feesucceeds. Null otherwise.splitobjectRequiredWho bears this refund: what the connected account gave back, the application fee returned to it, and what you paid.
Show child attributes
split.reversedintegerRequiredTaken back from the connected account: how much less you owe it because of this refund.
split.fee_returnedintegerRequiredApplication fee returned to the connected account with this refund.
split.from_youintegerRequiredWhat the refund costs you.