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
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
Pendingtransactions can be updated. Requests for successful or failed transactions will be rejected. Pending transactions include: Init / Checkout / WaitToConfirmRate 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.
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
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
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
emailwas 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/Failedas usual. Ifemailis 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?