Skip to main content

Documentación

Update Payment

Change or modify a payment when the status of the payment is ACT (active).

You can update the amount if the payment method supports this operation. For details, run Get Payment Method Required Fields and refer to the value of payment_method_options.is_updatable.

You can update other fields if is_updatable is set to true and the fields are listed under payment_options in the response from List Payment Methods by Country.

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_.

    • amount

    • Updated amount of the authorization. Relevant to payment methods that support adjustable authorization and merchants that are configured for it.

    • 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
        }
    }
  • Update Payment - Increase Amount

  • curl -X post 'https://sandboxapi.rapyd.net/v1/payments/payment_fb3f486eaf16c1d3e0c7c1b1bba85b22' \
    -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 '{
        "amount": 500,
        "description": "Increasing amount to 500"
    }'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "a336f29f-4b4d-4e9b-8a82-ca6cff275688"
        },
        "data": {
            "id": "payment_fb3f486eaf16c1d3e0c7c1b1bba85b22",
            "amount": 0,
            "original_amount": 500,
            "is_partial": false,
            "currency_code": "GBP",
            "country_code": "GB",
            "status": "ACT",
            "description": "Limousine service",
            "merchant_reference_id": "",
            "customer_token": "cus_9cb668a06820dfad16560fcb7d66bf8b",
            "payment_method": "card_2926398a8aa1df155399e837db4cc124",
            "payment_method_data": {
                "id": "card_2926398a8aa1df155399e837db4cc124",
                "type": "gb_visa_card",
                "category": "card",
                "metadata": null,
                "image": "",
                "webhook_url": "",
                "supporting_documentation": "",
                "next_action": "not_applicable",
                "name": "John Doe",
                "last4": "0100",
                "acs_check": "pass",
                "cvv_check": "pass",
                "bin_details": {
                    "type": "CREDIT",
                    "brand": "VISA",
                    "level": "CLASSIC",
                    "issuer": "VISA EUROPE LIMITED",
                    "country": "GB",
                    "bin_number": "417666"
                },
                "expiration_year": "29",
                "expiration_month": "01",
                "fingerprint_token": "ocfp_8eb736573e0985910cbd9303441ab75d",
                "network_reference_id": "000000258200813",
                "payment_account_reference": "V0010019169397631953494893013"
            },
            "auth_code": "404383",
            "expiration": 1771632000,
            "captured": false,
            "refunded": false,
            "refunded_amount": 0,
            "receipt_email": "",
            "redirect_url": "",
            "complete_payment_url": "https://www.demo123456.com/complete",
            "error_payment_url": "https://www.demo123456.com/error",
            "receipt_number": "",
            "flow_type": "",
            "address": null,
            "statement_descriptor": "Four Star Limousine",
            "transaction_id": "",
            "created_at": 1769060571,
            "metadata": {},
            "failure_code": "",
            "failure_message": "",
            "paid": false,
            "paid_at": 0,
            "dispute": null,
            "refunds": null,
            "order": null,
            "outcome": null,
            "visual_codes": {},
            "textual_codes": {},
            "instructions": [],
            "ewallet_id": "ewallet_c3016bb4e958f489046b5a7e82826063",
            "ewallets": [
                {
                    "ewallet_id": "ewallet_c3016bb4e958f489046b5a7e82826063",
                    "amount": 100,
                    "percent": 100,
                    "refunded_amount": 0
                }
            ],
            "payment_method_options": {
                "3d_required": true,
                "is_adjustable": true
            },
            "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": null,
            "group_payment": "",
            "cancel_reason": null,
            "initiation_type": "customer_present",
            "mid": "mid_26302_00000001",
            "next_action": "pending_capture",
            "error_code": "",
            "remitter_information": {},
            "save_payment_method": true,
            "merchant_advice_code": null,
            "merchant_advice_message": null,
            "authentication_result": {
                "eci": "05",
                "result": "A",
                "version": "2.2.0",
                "cardholder_info": 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"
        }
    }
  • Bad Request - Immutable Field

  • 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": "",
    		"currency": "COP",
    		"city": "Anytown",
    		"state": "NY",
    		"country": "US",
    		"zip": "12345",
    		"phone_number": "16125551234",
        "metadata": {
          "merchant_defined": "updates"
        },
    		"canton": "",
    		"district": ""
    	}
    }'
  • {
        "status": {
            "error_code": "IMMUTABLE_FIELD",
            "status": "ERROR",
            "message": "The field 'currency' cannot be modified after the payment object has been created. Corrective action: None. Updates require the same currency from the original transaction.",
            "response_code": "ERROR_INVALID_PARAMETER_VALUE",
            "operation_id": "f9a22b31-bc1a-4558-8121-ccb800a9b212"
        }
    }