Customers - Update
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
Customers - Update
Updates the customer’s details in a customer object.
PUT
/
v1
/
customers
/
{id}
Customers - Update
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
Body
application/json
Response
Customer was Updated
Was this page helpful?