Skip to main content

Documentation

Update Customer

Change one or more fields in a customer profile.

To clear a field, set it to an empty string.

Note

This method triggers the Customer Created Webhook. This webhook contains the same information as the response.

    • addresses

    • Array of 'address' objects associated with this customer. For details of the 'address' object, see Create Address.

    • birth_country

    • Country where the customer was born. Two-letter ISO 3166-1 ALPHA-2 code for the country. To determine the code for a country, see List Countries. English characters only. Relevant to an account funding transaction (AFT).

    • business_vat_id

    • The tax ID number of the customer.

    • coupon

    • The ID of a coupon that is assigned to this customer.

    • date_of_birth

    • Date of birth of the customer. Format: DD/MM/YYYY

      Required for an account funding transaction (AFT).

    • default_payment_method

    • The payment method that is used when the transaction does not specify a payment method. String starting with card_ or other_.

    • description

    • A text description of the customer.

    • email

    • Customer's email address. Recommended for an account funding transaction (AFT).

    • ewallet

    • ID of the wallet that is linked to the customer. String starting with ewallet_.

    • invoice_prefix

    • A custom string that is prefixed to all invoices for this customer.

      • name

      • The name of the individual customer or the business name.

      • nationality

      • The citizenship of the customer. Two-letter ISO 3166-1 ALPHA-2 code for the country. To determine the code for a country, see List Countries. English characters only. Relevant to an account funding transaction (AFT).

      • occupation

      • Occupation of the customer. Maximum: 35 characters. Relevant to an account funding transaction (AFT).

      • phone_number

      • Customer's primary phone number in E.164 format.

    Code Samples
      • .NET

        • using System;
          using System.Text.Json;
          
          namespace RapydApiRequestSample
          {
              class Program
              {
                  static void Main(string[] args)
                  {
                      try
                      {
                          string customerId = "cus_d3ed65d5091a8398cc3651bcedec1201";
          
                          var requestObj = new
                          {
                              default_payment_method = "card_0ef22c3b9fa5991a4da957d3dcee2e7b"
                          };
          
                          string request = JsonSerializer.Serialize(requestObj);
          
                          string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/customers/{customerId}", 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 = {
                default_payment_method: 'card_0ef22c3b9fa5991a4da957d3dcee2e7b'
              };
              const result = await makeRequest(
                'POST',
                '/v1/customers/cus_d3ed65d5091a8398cc3651bcedec1201',
                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);
          
          $body = [
              "default_payment_method"=> "card_0ef22c3b9fa5991a4da957d3dcee2e7b"
          ];
          
          try {
              $object = make_request('post', "/v1/customers/cus_d3ed65d5091a8398cc3651bcedec1201", $body);
              var_dump($object);
          } catch (Exception $e) {
              echo "Error: $e";
          }
          ?>
      • Python

        • from pprint import pprint
          
          from utilities import make_request
          
          customer_data = {
              "default_payment_method": "card_0ef22c3b9fa5991a4da957d3dcee2e7b",
          }
          result = make_request(method='post', path='/v1/customers/cus_d3ed65d5091a8398cc3651bcedec1201', body=customer_data)
          pprint(result)
          
    • /v1/customers/:customer

    • Add Default Payment Method

    • curl -X post
      'https://sandboxapi.rapyd.net/v1/customers/cus_4e25112ac20e144ad073a614dc46934b' \
      -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 '{
          "default_payment_method": "card_b9548d9b53a565b2315fecdc6c87f158"
      }'
    • {
          "status": {
              "error_code": "",
              "status": "SUCCESS",
              "message": "",
              "response_code": "",
              "operation_id": "f460eec5-2c72-4fc8-9594-17c58e9bca8c"
          },
          "data": {
              "id": "cus_4e25112ac20e144ad073a614dc46934b",
              "delinquent": false,
              "discount": null,
              "name": "John Doe",
              "default_payment_method": "card_b9548d9b53a565b2315fecdc6c87f158",
              "description": "",
              "email": "",
              "phone_number": "",
              "invoice_prefix": "",
              "addresses": [],
              "payment_methods": {
                  "data": [
                      {
                          "id": "other_330f2c3586e670b72aab45f5c12195c0",
                          "type": "in_jiomoney_ewallet",
                          "category": "ewallet_redirect",
                          "metadata": {},
                          "image": "https://iconslib.rapyd.net/checkout/in_jiomoney_ewallet.png",
                          "webhook_url": "",
                          "supporting_documentation": "",
                          "next_action": "not_applicable"
                      },
                      {
                          "id": "other_9a1fa177940e16c09f161cfa55ec108a",
                          "type": "sg_grabpay_ewallet",
                          "category": "ewallet",
                          "metadata": {},
                          "image": "https://iconslib.rapyd.net/checkout/sg_grabpay_ewallet.png",
                          "webhook_url": "",
                          "supporting_documentation": "",
                          "next_action": "not_applicable",
                          "bic_swift": "",
                          "account_last4": ""
                      },
                      {
                          "id": "other_0bfa8ede2535263dab8da20a384d5c2f",
                          "type": "pe_banco_ripley_cash",
                          "category": "cash",
                          "metadata": {},
                          "image": "https://iconslib.rapyd.net/checkout/pe_banco_ripley_cash.png",
                          "webhook_url": "",
                          "supporting_documentation": "",
                          "next_action": "not_applicable"
                      },
                      {
                          "id": "other_9162cf0e8ba033a39833b89b289b2581",
                          "type": "kr_localcards_redirect_card",
                          "category": "card_redirect",
                          "metadata": {},
                          "image": "https://iconslib.rapyd.net/checkout/kr_localcards_redirect_card.png",
                          "webhook_url": "",
                          "supporting_documentation": "",
                          "next_action": "not_applicable"
                      },
                      {
                          "id": "other_618d6e098d0ea74fd73ad9e91930df6d",
                          "type": "at_sofort_bank",
                          "category": "bank_redirect",
                          "metadata": {},
                          "image": "https://iconslib.rapyd.net/checkout/at_sofort_bank.png",
                          "webhook_url": "",
                          "supporting_documentation": "",
                          "next_action": "not_applicable",
                          "bic_swift": "",
                          "account_last4": ""
                      },
                      {
                          "id": "card_b9548d9b53a565b2315fecdc6c87f158",
                          "type": "gb_visa_card",
                          "category": "card",
                          "metadata": {},
                          "image": "https://iconslib.rapyd.net/checkout/gb_visa_card.png",
                          "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": "35",
                          "expiration_month": "12",
                          "fingerprint_token": "ocfp_e599f990674473ce6283b245e9ad2467",
                          "network_reference_id": "507150",
                          "payment_account_reference": "V001B26QCDPY3T7O4GGA9D6AL8QSH"
                      },
                      {
                          "id": "other_e4cd3a4bdcc26ab661420b306d2224ab",
                          "type": "mx_spei_bank",
                          "category": "bank_transfer",
                          "metadata": {},
                          "image": "https://iconslib.rapyd.net/checkout/mx_spei_bank.png",
                          "webhook_url": "",
                          "supporting_documentation": "",
                          "next_action": "not_applicable",
                          "bic_swift": "",
                          "account_last4": ""
                      }
                  ],
                  "has_more": false,
                  "total_count": 7,
                  "url": "/v1/customers/cus_4e25112ac20e144ad073a614dc46934b/payment_methods"
              },
              "subscriptions": null,
              "created_at": 1755769161,
              "metadata": {},
              "business_vat_id": "",
              "ewallet": "",
              "occupation": "",
              "birth_country": "",
              "date_of_birth": "",
              "nationality": ""
          }
      }
    • Add Discount

    • curl -X post
      'https://sandboxapi.rapyd.net/v1/customers/cus_9f4965b9807bc1aeae67b47a0ae5b081' \
      -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 '{
          "coupon": "coupon_4ab30530e8a7352ffe715deecfab57b9"
      }'
    • {
          "status": {
              "error_code": "",
              "status": "SUCCESS",
              "message": "",
              "response_code": "",
              "operation_id": "9966881a-1b22-4c4b-81c0-5a4ee8e4ff36"
          },
          "data": {
              "id": "cus_9f4965b9807bc1aeae67b47a0ae5b081",
              "delinquent": false,
              "discount": {
                  "id": "dis_d41d8cd98f00b204e9800998ecf8427e",
                  "coupon": {
                      "id": "coupon_f7c2c630d01a8effe46da9df3d271ad4",
                      "amount_off": 0,
                      "created": 1764590120,
                      "currency": "",
                      "duration": "repeating",
                      "duration_in_months": 3,
                      "max_redemptions": 10,
                      "metadata": {
                          "coupon_type": "Holiday promotional"
                      },
                      "percent_off": 10,
                      "redeem_by": 0,
                      "times_redeemed": 0,
                      "discount_valid_until": 0,
                      "discount_validity_in_months": 0,
                      "discount_duration_in_uses": 0,
                      "description": "",
                      "valid": true
                  },
                  "end": -1,
                  "start": 1764590995,
                  "subscription": "",
                  "number_of_uses": 0,
                  "valid": true
              },
              "name": "John Doe",
              "default_payment_method": "",
              "description": "",
              "email": "",
              "phone_number": "",
              "invoice_prefix": "",
              "addresses": [],
              "payment_methods": null,
              "subscriptions": null,
              "created_at": 1761819126,
              "metadata": {},
              "business_vat_id": "",
              "ewallet": "",
              "occupation": "",
              "birth_country": "",
              "date_of_birth": "",
              "nationality": ""
          }
      }
    • Bad Request - Invalid Phone Number

    • curl -X post
      'https://sandboxapi.rapyd.net/v1/customers/cus_4e25112ac20e144ad073a614dc46934b' \
      -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 '{
          "phone_number": "2125552341"
      }'
      
    • {
          "status": {
              "error_code": "INVALID_CUSTOMER_PHONE_NUMBER",
              "status": "ERROR",
              "message": "The request tried to create a customer, but the phone number was not recognized. The request was rejected. Corrective action: Provide the customer's phone number in proper E.164 format.",
              "response_code": "INVALID_CUSTOMER_PHONE_NUMBER",
              "operation_id": "f2c4a14f-2b54-482e-985b-87b52de48577"
          }
      }
    • Bad Request - Coupon Not Found

    • curl -X post
      'https://sandboxapi.rapyd.net/v1/customers/cus_c62e8561f1f9217676819dce60accc08' \
      -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 '{
          "coupon": "coupon_4ab30530e8a7352ffe715deecfab57b9"
      }'
    • {
          "status": {
              "error_code": "ERROR_GET_COUPON",
              "status": "ERROR",
              "message": "The request attempted an operation that requires the ID of a coupon, but the coupon was not found. The request was rejected. Corrective action: Use the ID of a valid coupon.",
              "response_code": "ERROR_GET_COUPON",
              "operation_id": "7f8d6ffb-72ae-4834-bf9a-1bc7b7000073"
          }
      }