Create buyer

POST
/api/v2/buyers
lts

Endpoint is responsible for creating a buyer without subscription. Can be used when the buyer is missed not in the system.

Header parameters
Attribute
Requirement
Description
x-public-key
mandatory
a public key that identifies the merchant account (there can be several for one merchant)
x-buyer-ip
mandatory
is responsible for information about the buyer's IP address
x-date
mandatory
is responsible for the date and time of sending the request
x-token
mandatory
generated on the merchant side
x-source
mandatory
identifier of the type of service that is the initiator of the request
x-id
mandatory
service identifier from which the current request is made
Request parameters
Attribute
Type
Requirement
Description
Standard
merchantCode
string
mandatory
Unique merchant code
-
email
string
mandatory
Buyer email
-
country
string
mandatory
Country code
ISO 3166-1 alpha-2
zip
string
OPTIONAL
Index
-
state
string
OPTIONAL
Region/state
-
locale
string
OPTIONAL
Localization language
ISO 639 set 1
<?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 = '{
  "merchantCode": "<your-brand-code>",
  "email": "test@test.test",
  "country": "nl",
  "zip": null,
  "state": null,
  "locale": "en"
}';
$request = new Request('POST', 'https://pay-sandbox.billerbase.com/api/v2/buyers', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
curl --location 'https://pay-sandbox.billerbase.com/api/v2/buyers' \
--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 'Content-Type: application/json' \
--data-raw '{
  "merchantCode": "<your-brand-code>",
  "email": "test@test.test",
  "country": "nl",
  "zip": null,
  "state": null,
  "locale": "en"
}'
1{
2  "merchantCode": "<your-brand-code>",
3  "email": "test@test.test",
4  "country": "nl",
5  "zip": null,
6  "state": null,
7  "locale": "en"
8}
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://pay-sandbox.billerbase.com/api/v2/buyers',
  '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({
    "merchantCode": "<your-brand-code>",
    "email": "test@test.test",
    "country": "nl",
    "zip": null,
    "state": null,
    "locale": "en"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
Response parameters
Attribute
Type
Description
data
object
Contains basic information about buyer
meta
object
Provides metadata about the response
{
  "data": {
    "id": "028afc6c-34d4-4925-8b08-4ea88a94a878"
  },
  "meta": {
    "type": "entity"
  }
}
Errors and interpretation

The list of possible errors for this endpoint, along with their types and interpretation, is provided in the general reference: Endpoint response errors.