| Example of a JSON Payment Object used to send and receive payment data to and from the MYGW server. { "clientID":"NewClient", "amount":"100", "cardType":"UnionPay", "currency":"USD", "echo":"", "orderID":"088345853", "replyURL":"https://www.oneroadpayments.com/ReturnURL.html", "backofficeURL":"https://www.oneroadpayments.com/returl.php", "sendEmail":0 "signature":"ffeee47ce763fa8ca9129d6ded4c9da0", "signatureVersion":"1.0", "client": { "clientID":"NewClient", "mobileNumber":"+610411123456", " clientPhone ":"+6121234567890", "name":"A Citizen", "emailAddress":" client@email.com ", "billingAddress": { "streetNumber":"100", "streetName":"New", "streetSuffix" : "St", "city":"Newtown", "state":"NSW", "postCode":"8888", "country":"Australia" } }, } Not all the elements of the object are required for every MYGW-PM API call and some are supplied by the MYGW server. The following tables describe which elements are mandatory for some calls and which are optional (as described below in the specific API calls). M: Mandatory. O: Optional. Payment Body Name | Description | M/O | clientID | Key or name to identify the customer, depending on the merchant this may be managed by the merchant or by the MYGW-CM system. Some merchants are required to include a valid clientID or new client object | O | amount | The amount of the purchase transaction | M | cardType | The type of payment card or account to be used for the transaction. Depending on the merchant this can be one of 'UnionPay', 'Alipay' or 'Wechat Pay' | M | currency | The transaction currency. This must match a currency setup for the merchant at sign up | M | echo | Value echoed back at the point of notification. This is not used during transaction authorization | O | orderID | The unique merchant order number for this transaction. This is used by the merchant or PSP to identify transactions with the MYGW server if required | M | replyURL | The ‘front end’ URL, called by MYGW-PM once the transaction completes with the result of the transaction. This URL will be displayed to the client to inform them of the result of the transaction. If this field is not set or left blank, the URL stored on the server for the merchant/PSP will be used | O | backofficeURL | The merchant or PSP back-end server URL called when a transaction completes with the result of the transaction. If this field is not set or left blank, the URL stored on the server for the merchant/PSP will be used | O | sendEmail | Flags whether the Email Pay process (see above) should be used to process this transaction. This is only relevant is the merchant is registered for Email Pay for this cardType | O | signature | The cryptographic hash for this payment transaction, created using the Merchant Key, used to authenticate the payment request | M | signatureVersion | Indicates the version of the signature to authenticate this transaction. Currently '1.0' | M | client | If a new client is being created for this transaction, contains the client object described below | O |
client The client data to be included in the client field of the payment request, should a merchant require that a new client be created at the MYGW-CM server. Name | Description | M/O | Name | Client’s name | O | clientID | Key or name to identify the customer | O | mobileNumber | The client's mobile phone number which may be used to securely communicate with, and identify the client | O | clientPhone | Alternative phone number of the client | O | emailAddress | Valid email address of the client, used to contact the client if necessary | O | created | Date and time when the client record was created, determined by the MYGW system | O | updated | Date and time when the client record was last updated, determined by the MYGW system | O | billingAddress | The client’s street or postal address, described below | O |
billingAddress The client’s address may optionally be provided when the client is created; in which case the details will be stored with the client record. Name | Description | R/M/O | streetNumber | The number on a street of the client’s postal address | O | streetName | the name of the street of the client’s postal address | O | streetSuffix | The tail of the street address, of the client’s postal address, typically St, Rd, etc | O | city | The town, city or village that is used in the client’s postal address | O | state | The state or region used in the client’s postal address | O | postcode | The postal code used in the client’s postal address | O | country | The country used in the client’s postal address | O |
An example of executable JavaScript sample source code to create a payment object can be found by clicking on the source code icon below. Note that this is an example of how a payment object is structured, it is a not a recommendation for how to implement the client APIs in your own applications. Signature Creation - Sample Source Code The signature field of the payment request is required to validate that the payment request originated from a valid merchant or PSP. The signature is created using unique transaction data and includes the Merchant Key allocated at sign up. The signature uses the MD5 message-digest hash function and the following transaction data: The clientID The orderId The amount The currency The replyURL The backofficeURL The signature is created by concatenating the lower-case data above; including the MD5 hash of the Merchant Key; and storing the signature as the MD5 hash of the resulting string. An example of executable JavaScript sample source code to create the signature can be found by clicking on the icon below. Note that this is an example of how a signature can be created, it is a not a recommendation for how to implement the payment API in your own applications. | |