Navigation: 4. CLIENT ACCOUNT MANAGEMENT >

The Create Client API Call

 

 

 

 

 

This call is used to add a new client’s details to the merchant’s specific MYGW-CM database.

 

URLs

 

Test 

https://api. test.oneroadpayments.com/merchants/{merchantID}/clients

Production 

https://api.oneroadpayments.com/merchants/{merchantID}/clients 

 

Request Method:          

 

POST

 

Headers:

 

The header ‘x-api-key’ should be set to the value of the Merchant API Key allocated to the merchant or PSP at sign up.

 

URL Parameters:

 

Name

Description

R/M/O

merchantID

The unique merchant ID provided by the PSP or allocated by the MYGW system

M

 

Client Body - Create Client Request

 

Name

Description

R/M/O

Name

Client’s name

O

clientID

Key or name to identify the customer

M

merchantID

The unique merchant ID provided by the PSP or allocated by the MYGW system

M

merchantName

The merchant’s name as stored on the MYGW server

O

mobileNumber

The client's mobile phone number which may be used to securely communicate with, and identify the client

M

clientPhone

Alternative phone number of the client

O

emailAddress

Valid email address of the client, used to contact the client if necessary

M

billingAddress

The client’s postal or home address, formatted as shown above

O

cards

Payment or card details of up to 3 accounts, formatted as shown above

O

 

The client data should be sent to the MYGW server formatted as a JSON object, using the POST method.

 

Client Body - Create Client Response

 

The MYGW server will respond including a status code, signifying whether the call succeeded, as described above - MYGW API Responses.

 

An example of the JSON object sent in a response to a successful create client request is as follows.

 

{

"response":

{

"statusCode": 201,

"message": "Successfully Created"

},

"client":

{

"merchantID": "9678h65fr-fb52-4a8a-8de6-438ecf8d1104",

"merchantName": "The Merchant",

"mobileNumber": "2244668800",

"clientID": "NewClient",

"created": "2024-07-13T08: 46: 39.347",

"updated": "2024-07-13T08: 46: 39.347",

"name": "NewClient",

"id": "a0f58b93-0336-458f-8111-d19aaf1b57e8",

"emailAddress": "newclient@client.org",

"black": false,

"billingAddress":

{

"streetNumber": "",

"streetName": "",

"streetSuffix": "",

"city": "",

"state": "",

"country": "",

"valid": false

},

"valid": true,

"correlatedBlack": false

}

}

 

The response will include a complete client object, as described above – The JSON Client Object, even if some of those fields (such as cards or billingAddress) are not set.

 

An example of the JSON object sent in a response to an unsuccessful create client request is as follows.

 

{

"response":

{

"statusCode": 400,

"message": "Bad Request",

"detail": "Invalid Merchant ID"

}

}


The status code and status message returned could be one of the following values.

 

Status Code

Description

Status Message

200/201

The new client was successfully created at the server

Message - Successfully Created

400

The merchant ID was invalid or not recognised, and the request failed

Message - Bad Request

Detail – Invalid Merchant ID

403

The merchant API key could not be validated, and the request failed

Message - Forbidden

409

A client with the specified details already exists at this merchant, and the request failed

Message – Conflict

Detail – ClientID already exists for merchant

500

A server error occurred, and the request failed

Message – Internal processing exception

 

Create Client - Sample Source Code

 

An example of executable JavaScript sample source code to create a client can be found by clicking on the source code icon below. Note that this is an example of how a create client request can be initiated, it is a not a recommendation for how to implement the client APIs in your own applications.

 

 

 

 

 

 

Copyright © 2024 My Gateway