Update Payment
Change or modify a payment when the status of the payment is ACT (active).
You can update additional fields if is_updatable is set to true and the fields are listed under payment_options in the response from Get Payment Method Required Fields.
You can update the amount if the payment method supports this operation.
This method triggers the Payment Updated Webhook. This webhook contains the same information as the response.
payment
ID of the payment. String starting with payment_.
description
Description of the payment transaction.
escrow
Determines whether the payment is held in escrow for later release.
false
escrow_release_days
Determines the number of days after creation of the payment that funds are released from escrow. Funds are released at 5:00 pm GMT on the day indicated.
Integer, range: 1-90.
90
receipt_email
Email address that the receipt for this transaction is sent to.
Code Samples
.NET
using System; using System.Text.Json; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string payment = "payment_2ea95624aa3a35f17bd96899d01eb8fd"; var metadata = new { merchant_defined = true }; var address = new { name = "John Doe", line_1 = "123 Main Street", line_2 = "Penthouse", line_3 = "", city = "Anytown", state = "NY", country = "US", zip = "12345", phone_number = "16125551234", metadata, canton = "", district = "", }; var requestObj = new { receipt_email = "", description = "", address, }; string request = JsonSerializer.Serialize(requestObj); string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/payments/{payment}", request); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const body = { receipt_email: '', description: '', address: { name: 'John Doe', line_1: '123 Main Street', line_2: 'Penthouse', line_3: '', city: 'Anytown', district: '', canton: '', state: 'NY', country: 'US', zip: '12345', phone_number: '16125551234', metadata: { merchant_defined: true } }, canton: '', district: '' }; const result = await makeRequest( 'POST', '/v1/payments/payment_37d00f85277fa24e18a2ad67379e044c', body ); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); // Message body: $body = [ 'receipt_email' => 'johndoe@rapyd.net' ]; try { $object = make_request('post', '/v1/payments/payment_19e3edad1e9102cd24006a34c52c9a0b', $body); var_dump($object); } catch(Exception $e) { echo "Error: $e"; } ?>
Python
from pprint import pprint from utilities import make_request payment = "payment_35544ff0d05c578c87ad171f2dd2ba6e" update_payment_body = { "description": "New Description" } response = make_request(method='post', path=f'/v1/payments/{payment}', body=update_payment_body) pprint(response)
/v1/payments/:payment
Update Payment - address
curl -X post 'https://sandboxapi.rapyd.net/v1/payments/payment_15fdb0163417657a84bbf85e584945fb' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "address": { "name": "John Doe", "line_1": "123 Second Street", "city": "Anytown", "country": "US", "zip": "12345", "phone_number": "16125551234", "email": "johndoe@rapyd.net" } }'{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "1db238c0-9e66-40a5-9d2d-430da899eb5d" }, "data": { "id": "payment_15fdb0163417657a84bbf85e584945fb", "amount": 0, "original_amount": 100.25, "is_partial": false, "currency_code": "MXN", "country_code": "MX", "status": "ACT", "description": "Payment by bank transfer", "merchant_reference_id": "", "customer_token": "cus_4e25112ac20e144ad073a614dc46934b", "payment_method": "other_7bfdc59abf6078a838031ce8b1b9f101", "payment_method_data": { "id": "other_7bfdc59abf6078a838031ce8b1b9f101", "type": "mx_spei_bank", "category": "bank_transfer", "metadata": {}, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable" }, "auth_code": null, "expiration": 1770040893, "captured": true, "refunded": false, "refunded_amount": 0, "receipt_email": "", "redirect_url": "", "complete_payment_url": "", "error_payment_url": "", "receipt_number": "", "flow_type": "", "address": { "id": "address_98fbe5db2d4dbfdd53c903633a0b4aa7", "name": "John Doe", "line_1": "123 Second Street", "line_2": "", "line_3": "", "city": "Anytown", "state": "", "country": "US", "zip": "12345", "phone_number": "16125551234", "metadata": {}, "canton": "", "district": "", "created_at": 1768832125 }, "statement_descriptor": "Doc Team", "transaction_id": "", "created_at": 1768831292, "metadata": {}, "failure_code": "", "failure_message": "", "paid": false, "paid_at": 0, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": [ { "name": "instructions", "steps": [ { "step1": "Direct the end-user to make payment to the CLABE provided." } ] } ], "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "ewallets": [ { "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 100.25, "percent": 100, "refunded_amount": 0 } ], "payment_method_options": {}, "payment_method_type": "mx_spei_bank", "payment_method_type_category": "bank_transfer", "fx_rate": 1, "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "", "cancel_reason": null, "initiation_type": "customer_present", "mid": "", "next_action": "pending_confirmation", "error_code": "", "remitter_information": {}, "merchant_advice_code": null, "merchant_advice_message": null, "transaction_link_id": null } }
Update Payment - Cancel Escrow
curl -X post 'https://sandboxapi.rapyd.net/v1/payments/payment_5bc52a40bd4b7f9318e1dc5018f446d3' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "escrow": false }'{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "a3a1570f-c78e-4a46-90b8-235648283e03" }, "data": { "id": "payment_5bc52a40bd4b7f9318e1dc5018f446d3", "amount": 100, "original_amount": 100, "is_partial": false, "currency_code": "EUR", "country_code": "GB", "status": "CLO", "description": "", "merchant_reference_id": "", "customer_token": "cus_4e25112ac20e144ad073a614dc46934b", "payment_method": null, "payment_method_data": { "id": null, "type": "gb_visa_card", "category": "card", "metadata": { "merchant_defined": "Prime customer" }, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable", "name": "John Doe", "last4": "1111", "acs_check": "unchecked", "cvv_check": "unchecked", "bin_details": { "type": "DEBIT", "brand": "VISA", "level": "CLASSIC", "issuer": "CONOTOXIA SP. Z O.O", "country": "PL", "bin_number": "411111" }, "expiration_year": "36", "expiration_month": "12", "fingerprint_token": "ocfp_e599f990674473ce6283b245e9ad2467", "network_reference_id": "272205", "payment_account_reference": "V001V8SS2521Y9PWSL1UI3ZFZNUAY" }, "auth_code": null, "expiration": 1769437602, "captured": true, "refunded": false, "refunded_amount": 0, "receipt_email": "", "redirect_url": "", "complete_payment_url": "https://complete.rapyd.net", "error_payment_url": "https://error.rapyd.net", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "Doc Team", "transaction_id": "", "created_at": 1768832802, "metadata": {}, "failure_code": "", "failure_message": "", "paid": true, "paid_at": 1768832802, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": [], "ewallet_id": null, "ewallets": [ { "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 20, "percent": 20, "released_amount": 20, "refunded_amount": 0 }, { "ewallet_id": "ewallet_31fb2dbbaf6519461ee4fbe1062220d3", "amount": 80, "percent": 80, "released_amount": 80, "refunded_amount": 0 } ], "payment_method_options": {}, "payment_method_type": "gb_visa_card", "payment_method_type_category": "card", "fx_rate": 1, "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": { "id": "escrow_3f249ee8930cd6d8cb971821c6766d57", "payment": "payment_5bc52a40bd4b7f9318e1dc5018f446d3", "currency": "EUR", "amount_on_hold": 0, "total_amount_released": 100, "status": "canceled", "escrow_release_days": null, "created_at": 1768832802, "updated_at": 1768832836, "last_payment_completion": 1768832803 }, "group_payment": "", "cancel_reason": null, "initiation_type": "customer_present", "mid": "", "next_action": "not_applicable", "error_code": "", "remitter_information": {}, "save_payment_method": false, "merchant_advice_code": null, "merchant_advice_message": null, "transaction_link_id": null } }
Bad Request - Not Updatable
curl -X post 'https://sandboxapi.rapyd.net/v1/payments/payment_d575afb9ff6d8267a2c16d05e17c9298' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "receipt_email": "", "description": "", "address": { "name": "John Doe", "line_1": "123 Main Street", "line_2": "Penthouse", "line_3": "", "city": "Anytown", "state": "NY", "country": "US", "zip": "12345", "phone_number": "16125551234", "metadata": { "merchant_defined": "updates" }, "canton": "", "district": "" } }'{ "status": { "error_code": "ERROR_PAYMENT_IS_NOT_UPDATABLE", "status": "ERROR", "message": "Please contact Rapyd Client Support.", "response_code": "ERROR_PAYMENT_IS_NOT_UPDATABLE", "operation_id": "156afbb1-30c0-4a3d-b685-995343032141" } }
Bad Request - Invalid Status
curl -X post 'https://sandboxapi.rapyd.net/v1/payments/payment_36724a4ea01b438fd24ac3ab00b29150' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "receipt_email": "", "description": "", "address": { "name": "John Doe", "line_1": "123 Main Street", "line_2": "Penthouse", "line_3": "", "city": "Anytown", "state": "NY", "country": "US", "zip": "12345", "phone_number": "16125551234", "metadata": { "merchant_defined": "updates" }, "canton": "", "district": "" } }'{ "status": { "error_code": "ERROR_UPDATE_PAYMENT", "status": "ERROR", "message": "The request tried to update a payment, but the status of the payment does not allow updates. The request was rejected. Corrective action: None. Determine why an attempt was made to change the payment when the 'status' was not 'ACT'.", "response_code": "ERROR_UPDATE_PAYMENT", "operation_id": "e5b66115-ef4f-4009-8554-fdc900a6a3a8" } }