Customers
Update a customer
Updates the information of a customer by defining the values for the passed parameters. Any parameters not supplied will remain unaltered.
POST
/
customers
/
{id}
Update a customer
curl --request POST \
--url https://pay.chargily.net/test/api/v2/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"address": {
"country": "<string>",
"state": "<string>",
"address": "<string>"
},
"metadata": {}
}
'import requests
url = "https://pay.chargily.net/test/api/v2/customers/{id}"
payload = {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"address": {
"country": "<string>",
"state": "<string>",
"address": "<string>"
},
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
email: '<string>',
phone: '<string>',
address: {country: '<string>', state: '<string>', address: '<string>'},
metadata: {}
})
};
fetch('https://pay.chargily.net/test/api/v2/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://pay.chargily.net/test/api/v2/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'address' => [
'country' => '<string>',
'state' => '<string>',
'address' => '<string>'
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://pay.chargily.net/test/api/v2/customers/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://pay.chargily.net/test/api/v2/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.chargily.net/test/api/v2/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "01hj0p5s3ygy2mx1czg2wzcc4x",
"entity": "customer",
"livemode": false,
"name": "Hocine Saad",
"email": null,
"phone": null,
"address": {
"country": "Algeria",
"state": "Tizi-Ouzou",
"address": "123 Main Street"
},
"metadata": null,
"created_at": 1702977791,
"updated_at": 1702977791
}
Path parameters
string
The ID of the customer.
Body parameters
string
The name of the customer.
string
The email of the customer.
string
The phone number of the customer.
object
The address of the customer
Show address
Show address
string
Two-letter country code (ISO 3166-1 alpha-2), eg: “dz”.
string
The state of the customer.
string
The address line of the customer.
key-value array
A Set of key-value pairs that can be used to store additional information
about the customer.
Returns
If the request is successful, it returns a customer object with the updated information.{
"id": "01hj0p5s3ygy2mx1czg2wzcc4x",
"entity": "customer",
"livemode": false,
"name": "Hocine Saad",
"email": null,
"phone": null,
"address": {
"country": "Algeria",
"state": "Tizi-Ouzou",
"address": "123 Main Street"
},
"metadata": null,
"created_at": 1702977791,
"updated_at": 1702977791
}
Previous
Retrieve a customerRetrieves all the information of an already-existing customer by providing it's unique identifier (ID).
Next
⌘I
Update a customer
curl --request POST \
--url https://pay.chargily.net/test/api/v2/customers/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"address": {
"country": "<string>",
"state": "<string>",
"address": "<string>"
},
"metadata": {}
}
'import requests
url = "https://pay.chargily.net/test/api/v2/customers/{id}"
payload = {
"name": "<string>",
"email": "<string>",
"phone": "<string>",
"address": {
"country": "<string>",
"state": "<string>",
"address": "<string>"
},
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
email: '<string>',
phone: '<string>',
address: {country: '<string>', state: '<string>', address: '<string>'},
metadata: {}
})
};
fetch('https://pay.chargily.net/test/api/v2/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://pay.chargily.net/test/api/v2/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'address' => [
'country' => '<string>',
'state' => '<string>',
'address' => '<string>'
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://pay.chargily.net/test/api/v2/customers/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://pay.chargily.net/test/api/v2/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.chargily.net/test/api/v2/customers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address\": {\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "01hj0p5s3ygy2mx1czg2wzcc4x",
"entity": "customer",
"livemode": false,
"name": "Hocine Saad",
"email": null,
"phone": null,
"address": {
"country": "Algeria",
"state": "Tizi-Ouzou",
"address": "123 Main Street"
},
"metadata": null,
"created_at": 1702977791,
"updated_at": 1702977791
}