The endpoint changes the buyer data if necessary. Currently, the endpoint is used only to change the email.
<?php
$client = new Client();
$headers = [
'x-date' => '<current date format(Y-m-d H:i:s.u)>',
'x-public-key' => '<your public key uuid>',
'x-buyer-ip' => <external ip>',
'x-token' => '<generated token>',
'x-source'=> 'shop',
'x-id' => '<your-service-id>'
'Content-Type' => 'application/json'
];
$body = '{
"email": "test@test.com"
}';
$request = new Request('PATCH', 'https://pay-sandbox.billerbase.com/api/v2/buyers/000229c8-e3b7-480e-a482-4408f7b969b8', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();curl --location --request PATCH 'https://pay-sandbox.billerbase.com/api/v2/buyers/000229c8-e3b7-480e-a482-4408f7b969b8' \
--header 'x-date: <Y-m-d H:i:s.u (current date)>' \
--header 'x-public-key: <your public key uuid>' \
--header 'x-buyer-ip: <external ip>'\
--header 'x-token: <generated token>' \
--header 'x-source: shop' \
--header 'x-id: <your-service-id>'
--header 'Content-Type: application/json' \
--data-raw '{
"email": "test@test.com"
}'1{
2 "email": "test@test.com"
3}var request = require('request');
var options = {
'method': 'PATCH',
'url': 'https://pay-sandbox.billerbase.com/api/v2/buyers/000229c8-e3b7-480e-a482-4408f7b969b8',
'headers': {
'x-date': '<current date format(Y-m-d H:i:s.u)>',
'x-public-key': '<your public key uuid>',
'x-buyer-ip': <external ip>',
'x-token': '<generated token>',
'x-source': 'shop',
'x-id': '<your-service-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"email": "test@test.com"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});Depending on the success of the request, the following answers may be received:
HTTP: 204(No content) is returned - the email has been successfully changed.HTTP returns: 404(Not Found) is returned - the buyer not found in the Billing database.HTTP: 409(Conflict) is returned - this email is ALREADY busy.HTTP: 422(Unprocessable Content) is returned - the email has been .The list of possible errors for this endpoint, along with their types and interpretation, is provided in the general reference: Endpoint response errors.