Status
It’s important to note that for integration purposes, the merchant should use the staging environment instead of the production.
There are three ways to obtain transaction statuses:
- Using the resultUrl request parameter: This URL will redirect the customer to a page with the status of the operation after a 3DS transaction has been processed. However, it is not used if the transaction goes through a non-3DS process. It’s important to note that the cardholder will be redirected regardless of whether the transaction is approved or declined. It is not recommended to rely solely on this parameter to retrieve results from the gateway because all parameters go through the client’s browser and can be lost during transmission.
- API status request: The merchant can use the Order status API call to retrieve the customer’s order transaction status. After sending any type of transaction to the server and receiving an order ID in return, the merchant should regularly check for the transaction status by pulling for it. When the transaction is processed on the server, it will return its status to the merchant. At this point, the merchant can display the transaction result to the customer, indicating whether it was approved or declined. It is recommended to pull the status every 3-5 seconds for the first 5 minutes, then continue requests for up to an hour once in 5-10 minutes. After that, it’s better to wait for a webhook (if it is set up in the RequestorID or sent via API).
- Using the webhookUrl request parameter: This URL will receive the transaction result and can be used for custom processing of the transaction completion, such as collecting sales data in the merchant’s database. More information can be found under the “webhook” section.
Examples for different languages
Here is the example for fetching an order status.
// openapi-generator-cli generate -i https://HELP_NAME/api/openapi -g java -o out
import org.openapitools.client.ApiClient;import org.openapitools.client.ApiException;import org.openapitools.client.model.StatusRequest;import org.openapitools.client.model.StatusResponse;
public class GetStatusExample { public static void main(String[] args) throws ApiException { Integer requestorId = 10; String basePath = "https://{SERVER_BASE_PATH}"; String bearerToken = "bt_q1***13"; long orderSystemId = 54321;
ApiClient apiClient = new ApiClient(); apiClient.setBasePath(basePath); apiClient.setBearerToken(bearerToken);
PaymentsApi api = new PaymentsApi(apiClient);
StatusRequest statusRequest = new StatusRequest(); statusRequest.setOrderSystemId(orderSystemId);
StatusResponse statusResponse = api.paymentsStatusRequestorIdPost(requestorId, statusRequest);
System.out.println("statusResponse = " + statusResponse); }}// openapi-generator-cli generate -i https://HELP_NAME/api/openapi -g php -o out
$token = 'bt_q1***13';$requestor_id = 10; // int | Requestor ID$order_id = 54321;
$stack = new GuzzleHttp\HandlerStack();$stack->setHandler(new GuzzleHttp\Handler\CurlHandler());$options = ['handler' => $stack];$client = new GuzzleHttp\Client($options);
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken($token);
$apiInstance = new OpenAPI\Client\Api\PaymentsApi( $client, $config);
$status_request = new OpenAPI\Client\Model\StatusRequest();$status_request->setOrderSystemId($order_id);
try { $result = $apiInstance->paymentsStatusRequestorIdPost($requestor_id, $status_request); print_r($result);} catch (Exception $e) { echo 'Exception when calling PaymentsApi->paymentsStatusRequestorIdPost: ', $e->getCode(), $e->getMessage(), PHP_EOL;}// openapi-generator-cli generate -i https://HELP_NAME/api/openapi -g go -o outpackage main
import ( "fmt" "strings" "net/http" "io/ioutil")
func main() {
url := "{{SERVER_BASE_URL}}/payments/status/10"
payload := strings.NewReader("{ \"orderSystemId\": 54321 }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", "Bearer bt_q1***13")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}