We have another way of checking if the payment are processed using a transaction token.
There are three steps to this process:
- Generating the transaction token
- Completeing the transaction
- Looking up the transaction token
To get started, please look at the code example here.
TIP You can open the file with notepad, if you do not have an editor for viewing source code.
Generating the transaction token
If you run the code by uploading it to your server and navigate to the file, you are presented with a input form and a call to the API function “transaction_token_generate” is automaticly made, and is returning a transaction token back in the response. The token is important later.
The form looks like this:
If you’re unsure of how to fill in the input form, please look at the table below:
The “Name” column is listing the parameter names and they are case sensitive.
|version||Which version of the payment window that should be used. 201 is a stable version and should not be changed unless you know what you’re doing.|
Activated with the value ‘1’ and deactivated with the value ‘0’
If ccrg is turned on it will also be in the response. You need store that id from the response because you need it for rebilling, as it serves as our key to the purchasers saved credit card details.
|MerchantNumber||The merchantid of the receiver|
|CurrencyCode||ISO-4217 currency code that the payment should be paid in. For a full list of codes look here.|
|amount||The amount in the subunit of the selected currency to be charged on the purchasers credit card.|
|time||Unix timestamp of the moment of the transaction.|
|cartid||The orderid you want to add to the transaction.|
|customer_email||The email address of the purchaser|
|customername||The full name of the purchaser|
|accepturl||The url that the purchaser is forwarded to after the payment is complete. Normally a thank you page|
|lang||The Language culture name for the language to use in the payment window. For a full list look here.|
|ShopPlatform||The platform used to pay with yourpay.|
Completeing the transaction
When you submit the form, an iframe is created and the transaction token along with the input from the form is sent to our payment window which is embedded in the iframe.
The purchaser can then complete the payment.
Looking up the transaction token
When the payment is complete, you can make the call to our API function ‘transaction_token_lookup’ to verify that the transaction is paid.
We recommend making this call with AJAX as soon as you make the iframe and retry every 5-10 seconds. The button call in the code example is just for simplicity.
For this call you need to provide the following parameters:
|token||The transaction token generated in step 1.|
|response||‘1’ if the transaction is paid, ‘0’ otherwise.|
|amount||the amount charged on the purchasers credit card in the subunit of the currency|
|cardno||The first six and last four digits of the card number.|
|tid||An id used to identify the payment|
|TransID||An id used to identify the payment|
|orderid||The orderid you set on the transaction.|
|ccrg||The id used to reference saved credit card details.|
|tchecksum||SHA1 encodeing of PaymentID & Integrationcode.|
|numrows||The number of entries found in the lookup.|