curl --request PUT \
--url https://sandbox.hyperswitch.io/v1/customers/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--data '
{
"email": "guest@example.com",
"name": "John Doe"
}
'import requests
url = "https://sandbox.hyperswitch.io/v1/customers/{id}"
payload = {
"email": "guest@example.com",
"name": "John Doe"
}
headers = {
"X-Profile-Id": "<x-profile-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Profile-Id': '<x-profile-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({email: 'guest@example.com', name: 'John Doe'})
};
fetch('https://sandbox.hyperswitch.io/v1/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.hyperswitch.io/v1/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'guest@example.com',
'name' => 'John Doe'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"X-Profile-Id: <x-profile-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/v1/customers/{id}"
payload := strings.NewReader("{\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://sandbox.hyperswitch.io/v1/customers/{id}")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v1/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\"\n}"
response = http.request(request)
puts response.read_body{
"id": "0a_cus_01926c58bc6e77c09e809964e72af8c8",
"merchant_reference_id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"created_at": "2023-01-18T11:04:09.922Z",
"connector_customer_ids": {},
"name": "Jon Test",
"email": "JonTest@test.com",
"phone": "9123456789",
"phone_country_code": "+65",
"description": "First Customer",
"default_billing_address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe",
"origin_zip": "08807"
},
"default_shipping_address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe",
"origin_zip": "08807"
},
"metadata": {},
"default_payment_method_id": "0a_pm_01926c58bc6e77c09e809964e72af8c8",
"tax_registration_id": "123456789",
"document_details": {
"document_type": "cpf",
"document_number": "12345678911"
}
}Customers - Update
Updates the customer’s details in a customer object.
curl --request PUT \
--url https://sandbox.hyperswitch.io/v1/customers/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--data '
{
"email": "guest@example.com",
"name": "John Doe"
}
'import requests
url = "https://sandbox.hyperswitch.io/v1/customers/{id}"
payload = {
"email": "guest@example.com",
"name": "John Doe"
}
headers = {
"X-Profile-Id": "<x-profile-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'X-Profile-Id': '<x-profile-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({email: 'guest@example.com', name: 'John Doe'})
};
fetch('https://sandbox.hyperswitch.io/v1/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.hyperswitch.io/v1/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email' => 'guest@example.com',
'name' => 'John Doe'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"X-Profile-Id: <x-profile-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/v1/customers/{id}"
payload := strings.NewReader("{\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://sandbox.hyperswitch.io/v1/customers/{id}")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v1/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"guest@example.com\",\n \"name\": \"John Doe\"\n}"
response = http.request(request)
puts response.read_body{
"id": "0a_cus_01926c58bc6e77c09e809964e72af8c8",
"merchant_reference_id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"created_at": "2023-01-18T11:04:09.922Z",
"connector_customer_ids": {},
"name": "Jon Test",
"email": "JonTest@test.com",
"phone": "9123456789",
"phone_country_code": "+65",
"description": "First Customer",
"default_billing_address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe",
"origin_zip": "08807"
},
"default_shipping_address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe",
"origin_zip": "08807"
},
"metadata": {},
"default_payment_method_id": "0a_pm_01926c58bc6e77c09e809964e72af8c8",
"tax_registration_id": "123456789",
"document_details": {
"document_type": "cpf",
"document_number": "12345678911"
}
}Authorizations
Format: api-key=<api_key>
Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.
Headers
Profile ID associated to the customer
Path Parameters
The unique identifier for the Customer
Body
The customer's name
255"Jon Test"
The customer's email address
255"JonTest@test.com"
The customer's phone number
255"9123456789"
An arbitrary string that you can attach to a customer object.
255"First Customer"
The country code for the customer phone number
255"+65"
Address details
Show child attributes
Show child attributes
Address details
Show child attributes
Show child attributes
You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
The unique identifier of the payment method
"0a_pm_01926c58bc6e77c09e809964e72af8c8"
The customer's tax registration number.
255"123456789"
Show child attributes
Show child attributes
Response
Customer was Updated
Unique identifier for the customer
32 - 64"0a_cus_01926c58bc6e77c09e809964e72af8c8"
The identifier for the customer object
1 - 64"cus_y3oqhf46pyzuxjbcn2giaqnb44"
A timestamp (ISO 8601 code) that determines when the customer was created
"2023-01-18T11:04:09.922Z"
Connector specific customer reference ids
The customer's name
255"Jon Test"
The customer's email address
255"JonTest@test.com"
The customer's phone number
255"9123456789"
The country code for the customer phone number
255"+65"
An arbitrary string that you can attach to a customer object.
255"First Customer"
Address details
Show child attributes
Show child attributes
Address details
Show child attributes
Show child attributes
You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
The identifier for the default payment method.
64"0a_pm_01926c58bc6e77c09e809964e72af8c8"
The customer's tax registration number.
255"123456789"
Show child attributes
Show child attributes
Was this page helpful?