Link Payment API
Link Payment API
Generate Link Payment URL
To generate a new link for payment, parameters is sent to a URL and the link is returned in the response. Parameters is sent using HTTP(s) POST to
https://{psp-url}/admin/link_pay
Parameters
NAME | FORMAT | MANDATORY | DESCRIPTION |
merchant_id | string | yes | Merchants unique id. |
order_id | string | yes | Order id is a reference generated by the merchants system it has maximum length is 20 chars. Order id should be unique to make it easy to trace payment issues and avoid errors with certain payments. Payments may however reuse order id when customers have issues with owned payment cards and try using another payment card. |
amount | string | yes | The amount of the transaction must be 1 unit-of-currency (100 = 1 kr). |
currency | string | no | Currency to be used in payment: ‘SEK’,‘EUR’,‘DKK’,‘NOK’,‘GBP’,‘USD’,'PLN', 'HRK'. Default ‘SEK’. |
language | string | no | Language in payment window. ‘SE’,’NO’,’DK’,’GB’, 'FI', 'PL', 'HR'. Default ‘SE’. |
accept_url | string | yes | URL where customer is redirected after successful payment. |
cancel_url | string | no | URL where customer is redirected when clicking cancel in payment window. |
callback_url | string | no | URL where payment gateway sends transaction data after successful payment. |
do_3d_secure | string | yes | ‘NO’ disables 3D-Secure. Please note that the banks liability shift is not active if 3D-secure is not used. Default ’YES’. |
pay_method | string | no | To control which payment methods to display in payment window. ‘PAYWIN’ displays all payment methods. ‘CARD’/ 'DEBITCARD'/'CREDITCARD' displays only card entry. ‘BANK’ displays only bank payment. 'INVOICE' displays only invoice payment,'SWISH' displays only swish payment. Default ‘PAYWIN’. |
return_method | string | no | Method to call accept_url. ’POST’ or ’GET’. Default ’POST’. |
prompt_name_entry | string | no | Control if cardholder name entry should be displayed in payment window. ‘YES’ activates fields. Default ‘NO’. |
result_redirect | string | no | ‘NO’ means that customer is displayed a web page after successful payment instead of being redirected to accept_url. Default ‘YES’. |
create_subscription | string | no | ‘YES’ means that an extra parameter ‘subscription_trans_id’ is sent to accept and callback-url if payment is successful. This is a reference to the card number that can be used later to debit the card. Please note that this requires support at the acquiring bank. |
posenv | string | no | Used to define where the transaction originates. This is important to match the acquiring agreement. ‘SSL’, ‘MAIL’, ‘TELEPHONE’ Default: ‘SSL’ |
capture_now | string | no | ‘YES’ means that the payment is flagged for automatic debit. No separate call for debit is required. Default ‘NO’. |
customer_name | string | no | The full name of the customer. Required for invoice payments. |
customer_street1 | string | no | Street address of customer. Required for invoice payments. |
customer_street2 | string | no | Street address of customer |
customer_zipcode | string | no | Zip code of customer. Required for invoice payments. |
customer_city | string | no | Customers city. Required for invoice payments. |
oiTypes | string | no |
Names of columns for order rows described left to right. Names are separated by ';' (semi colon). Valid names are:
AMOUNT, DESCRIPTION, ITEMID, ITEMPRICE, QUANTITY, DISCOUNT, VATPERCENT
|
oiRow(1..n) | string | no | Contains the order row for the payment in the same order as oiTypes. Each row is described by "oiRow1", "oiRow2" and so on. |
mac | string | no | SHA-256 checksum calculated as the example below. |
Status: 200 OK { "id": "103R042eZvKYlo2CGzSAyQA6", "result": "Success", "url": "https://{psp-url}/pay/link/103R042eZvKYlo2CGzSAyQA6" }
Response:
MAC calculation
Sort all parameters in alphabetic order based on the parameter name:
accept_url | https://www.butiken.com/store/show_receipt?order_id=WebOrder-2023 |
amount | 1000 |
callback_url | https://payment.butiken.com/notification |
currency | SEK |
merchant_id | 1007 |
order_id | WebOrder-2023 |
pay_method | PAYWIN |
Copy all parameter values to a buffer:
https://www.butiken.com/store/show_receiptorder_id=WebOrder20231000https://payment.butiken.com/notificationSEK1007WebOrder-2023PAYWIN
Append the merchants secret:
X85LmHiJ98 https://www.butiken.com/store/show_receiptorder_id=WebOrder20231000https://payment.butiken.com/notificationSEK1007WebOrder-2023PAYWINX85LmHiJ98
Calculate SHA-256-sum on the string buffer:
0a87b7f2c02f661d9bc982de586346f5dfd6ce0017cf8cdf74067c6518704639
Example link generate request:
Below is an example request from command line to generate a link.
curl https://{domain}/api/v1/merchants -d "accept_url=https://www.butiken.com/store/show_receiptorder_id=WebOrder2023&amount=1000&callback_url=https://payment.butiken.com/notification¤cy=SEK&merchant_id=1007&order_id=WebOrder2023&pay_method=PAYWIN&mac=0a87b7f2c02f661d9bc982de586346f5dfd6ce0017cf8cdf74067c6518704639"
Using curl:
Status: 200 OK { "id": "103R042eZvKYlo2CGzSAyQA6", "result": "Success", "url": "https://{psp-url}/pay/link/103R042eZvKYlo2CGzSAyQA6" }