Navigation: 4. CLIENT ACCOUNT MANAGEMENT >

The Update Client API Call

 

 

 

 

 

This call is used to update an existing client’s information or add new client information to an existing client entry in the MYGW-CM database.

 

URLs:          

 

Test

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

Production

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

 

Request Method:          

 

PUT

 

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

clientID

Uniquely identifies a client within a merchant’s registered client collection. This can be either the clientID or id parameters detailed in the client object above

M

 

Client Body - Update 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 new or updated client data should be sent to the MYGW server formatted as a JSON object, using the PUT method.

 

Client Body - Update 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 update client request is as follows.

 

{

"response":

{

"statusCode": 200,

"message": "OK"

},

"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": "Updated Street Number",

"streetName": " Updated Street",

"streetSuffix": "Updated Suffix",

"city": "Updated City",

"state": "Updated State",

"country": "Updated Country",

"valid": false

},

"valid": true,

"correlatedBlack": false

}

}

 

The response will not necessarily include a complete client object (as described above – The JSON Client Object), only fields that were included when the client was created or updated on the system. If some of those fields (such as cards or billingAddress) are not set, they will not be returned from the host.

 

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

The client details were successfully updated at the server

Message - OK

400

The request was not correctly formatted

Message - Malformed request

Detail – (e.g) missing path parameters

403

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

Message - Forbidden

404

No client with the ID specified was found for the merchant at the server

Message – Not Found

Detail – No Client found with MerchantID and ClientID

500

A server error occurred, and the request failed

Message – Internal processing exception

 

Update Client - Sample Source Code

 

An example of executable JavaScript sample source code to update a client’s data can be found by clicking on the icon below. Note that this is an example of how an update 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