Overview
Customer-Present Cloud utilizes the Payment API within the backend in order to process payment requests. The Payment API utilize POST requests to submit API calls, the Customer-Present Cloud integration will utilize this same method.
This article will run through how to build and process your first payment with Customer-Present Cloud.
Performing a Cloud Transaction
For a full list of all available variables you may review the Customer-Present Cloud Documentation within the Integration Portal. (Login to the Merchant Gateway Account > Select Help > Select Integration Portal)
In order to perform a Customer-Present Cloud transaction you will need to include required variables such as:
Variable Name | Description |
security_key | API Security Key assigned to a merchant account. New keys can be generated from the merchant control panel in Settings > Security Keys. Note: Using the 'username' and 'password' variables in the request will result in an error. |
poi_device_id | The registered terminal ID. Provide on transaction types of sale, auth, credit and validate. |
response_method | Set value as 'asynchronous' in order to receive the async_status_guid value, which will need to be used to poll the transaction's status. |
Along with the required variables you will also need to submit the request to the API endpoint, which may be found within the Customer-Present Cloud documentation found in the Integration Portal. The Customer-Present Cloud payment endpoint will end with /api/transact.php
.
Here is an example request utilizing both required variables and additional variables. The example request will show a sale request for 10.00 units and should be posted to the proper API endpoint:
POST: /api/transact.php PARAMS: [ security_key : your_security_key poi_device_id : "Device ID returned at time of registration"
response_method : asynchronous
type : sale
amount : 10.00 ]
Here is an example response which would be returned upon a successful transaction:
response=1&responsetext=Request Accepted&authcode=&transactionid=&avsresponse=&cvvresponse=&
orderid=&type=sale&response_code=101&cc_exp=10/25&cc_number= xxxxxxxxxxxxx1111&cc_type=
&address_1=&city=&first_name=&last_name=&postal_code=&
async_status_guid=6944e524-5ac9-458e-b8b7-000000000000&
platform_id=6944e524-5ac9-458e-b8b7-000000000000&masked_merchant_number=
Once the the response is received you will receive an async_status_guid
, this will then need to be used in order to poll the transaction with the Async API in order to determine the transactions outcome. For more information on the Async API, please review the Async documentation found within the Customer-Present Cloud section of the integration portal.
Polling Against the Async Guid
Once you have received the request has been completed and you have received the async_status_guid
from the API response, you will now need to poll this guid utilizing the AsyncStatus API. This is necessary as the API will determine whether or not the consumer's interaction with the POI device has been completed and whether or not the transaction was successful.
With the use of the async_status_guid
value received in the transaction response the integration will need to submit a GET request to the AsyncStatus endpoint (The appropriate endpoint may be found within the AsyncStatus API section of the Customer-Present Cloud documentation within the Integration Portal :
/api/asyncstatus
For this request you will need to perform authentication utilizing the HTTP Bearer Authentication Header:
Authorization: Bearer {MERCHANT_API_KEY}
The request will additionally need to include the async_status_guid
in order to poll against the appropriate transaction. Here is an example request:
curl --request GET --header "Authorization: Bearer {MERCHANT_API_KEY}"
".../api/asyncstatus/"Your async_status_guid Here"
The above GET request will poll against the provided async guid and return a response similar to the example below.
{
"transaction": {
"id": null,
"success": false,
"condition": "",
"authCode": ""
},
"platformId": "70a6272c-4949-4515-956a-6e5ae4d5a10c",
"asyncStatusGuid": "70a6272c-4949-4515-956a-6e5ae4d5a10c",
"asyncStatus": "inFlight"
}
From the response we receive important information such as the final transaction id (Shown as id
) and the asyncStatus
(the current status of the transaction). The asyncStatus
will respond with the current status of the transaction. There are multiple different values which may be assigned to this parameter, a full list of values for this parameter may be found within the AsyncStatus API documentation. Here are a two example values which may be returned via the asyncStatus
parameter within the response:
Async Status | Description |
inFlight | The customer is still interacting with the POI Device. There may or may not be a transaction created at this point. |
interactionComplete | The transaction has completed, and POI Device interaction has ceased. A new transaction can be started on this device. |
When polling the async guid, should the transaction be completed the asyncStatus
value will show as interactionComplete
and the response will share the final transaction id(if not previously returned, while transaction was inFlight
), along with any additional parameters returned with the specified transaction.
Further examples of possible response methods may be found within the Integration Portal, under the Customer-Present Cloud documentation.