Skip to content

Technical FAQ

Daniel Marek edited this page Nov 23, 2015 · 27 revisions

I am getting http status 400, bad request when calling the eAPI

In most of the cases, the reason is the wrong signature. The most common mistakes are:

  • the string for calculation of the signature is incorrect or the signature calculation algorithm is wrong. Please see more details in eAPI specification
  • incorrect private key is used for the signature (i.e. integration and production environment key mismatch)

What algorithm do I need to create and verify signature?

To create and verify signature use algorithm based on SHA-1. For example in Java use for getting instance of class java.security.Signaturealgorithm "SHA1withRSA", in PHP use "OPENSSL_ALGO_SHA1", default algorithm foropenssl_sign()aopenssl_verify()` functions.

Example of crypto operations in Java

Can the cart contain multiple items?

The eAPI v1 requires at least one (e.g.”credit top-up) and maximum two cart (e.g. “mobile phone” and “shipping”) items. Future versions will introduce a new cart with broader options.

I am getting response code 900 when calling payment/init operation

Beware of correct format of cart parameter, payment gateway expects the list of fields for cart parameter, i.e. fields must be enclosed in [ and ], especially if cart contains only single item.

correct cart content with one item:

"cart":[ { "name":"Reservation", "quantity":1, "amount":10000 } ]

incorrect:

"cart": { "name":"Reservation", "quantity":1, "amount":10000 }

How to load the public key in PEM format?

The public key of the payment gateway is distributed in the text PEM format. Please use the following examples for initialitaztion:

JAVA

String publicKeyFileName = "test.pub";
String content = FileUtils.readFileToString(new File(publicKeyFileName));
content = StringUtils.remove(content, "-----BEGIN PUBLIC KEY-----");
content = StringUtils.remove(content, "-----END PUBLIC KEY-----");
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(Base64.decodeBase64(content));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(keySpec);

PHP

$publicKeyFileName = "test.pub";
$fp = fopen ($publicKeyFileName, "r" );
if (! $fp) {
    throw new Exception ( "Public key " . $publicKeyFileName . " not found" );
}
$content = fread ($fp, filesize ( $publicKeyFileName ) );
fclose ( $fp );
$publicKey = openssl_get_publickey ( $content );

The payment/process call returns http status 404, not found

Operation payment/process is called using the GET method. Please make sure that the last portion of the URL - signature parameter - is "URL encoded". The signature is transmitted to the gateway as Base64 encoded, therefore contains with a high probability the / character. Payment gateway will not accept the incorrectly formatted request (as it can not load the signature).

Legacy API (migration from GP Webpay) - how to call the transaction status

Legacy API does not support the transaction status enquiry. The operation [payment/status] is supported the new new eAPI

Clone this wiki locally