For the complete documentation index, see llms.txt. This page is also available as Markdown.

Patch a Transaction

Use this endpoint to add non-critical data to a transaction after it has been initiated, but before it reaches a final state. The first supported field is email, used to deliver a digital receipt when the payment succeeds.

This is useful when you cannot collect the email before initiating the transaction — for example, a guest checkout, a backend-initiated transaction, or a flow where the email is entered on a later screen.

The patch endpoint is available on both Hosted Payment Page and Hosted Component integrations. The request and response are identical across both; only the base URL differs.

Endpoint

Method: POST

Environment
Base URL

Sandbox

https://sandbox.codapayments.com/airtime/api/restful/v2.0/Payment/component/patch.json

Production

https://airtime.codapayments.com/airtime/api/restful/v2.0/Payment/component/patch.json

Note: This endpoint is available on v2.0 only.

When a Patch Is Accepted

  • Status Restriction: Only Pending transactions can be updated. Requests for successful or failed transactions will be rejected. Pending transactions include: Init / Checkout / WaitToConfirm

  • Rate Limit: A transaction can only be patched once. Subsequent requests will fail.

  • Time Window: Transactions older than 3 months cannot be updated.

Request Body

Send the request body in JSON format.

Parameter
Type
Required
Description

patchRequest

Object

Yes

Must be a valid JSON object.

patchRequest.apiKey

String

Yes

Your Coda API key.

patchRequest.projectId

String

Yes

Your project ID.

patchRequest.txnId

Numeric

Yes

The transaction ID returned by init.json.

patchRequest.profile

Object

No

User profile information, using the same structure as init.json.

patchRequest.profile.entry

Array

No

List of key-value pairs. The only key processed today is email.

patchRequest.profile.entry[].key

String

No

The profile entry key (e.g. email).

patchRequest.profile.entry[].value

String

No

The profile entry value. For email, this is the address where the receipt is sent on success.

A request that contains no profile entries is accepted as a no-op and returns success.

Example Request

Response

A successful patch returns resultCode 0. The response echoes the txnId.

Response Parameters

Parameter
Type
Description

patchResult

Object

Container for the patch result.

patchResult.resultCode

Numeric

0 on success. Otherwise an error code (see below). Describes the outcome of the patch call only — not the transaction's payment status.

patchResult.resultDesc

String

"Success" on success; an error description otherwise.

patchResult.txnId

Numeric

Echoes the txnId from the request.

Error Codes

Result Code
Description
Troubleshooting / Reason

103

Invalid Parameter

Missing required fields, or invalid email format.

204

Authentication Failed

Invalid apiKey or projectId.

208

Invalid Status

Transaction is not in a Pending state.

236

Merchant Mismatch

The transaction belongs to another merchant.

241

Transaction Too Old

The transaction is older than 3 months.

413

Transaction Not Found

Invalid or unrecognised txnId.

473

Already Patched

This transaction has already been updated once.

Typical Flow

Notes

  • Receipt delivery is not enabled by default. To activate automated receipt delivery for your titles, contact the payment enablement team at codapay_integration@coda.co.

  • Last value wins. If email was already set at init or by a previous patch, the new value replaces it. Patching with the value the field already holds returns success and changes nothing.

  • No webhook is sent for a patch. Existing transaction completion notifications continue to fire on Success / Failed as usual. If email is set and receipt delivery is enabled, the receipt is sent to the value that is current when the transaction succeeds.

Last updated

Was this helpful?