Quickpay Link
The Quickpay Link feature enables you to generate an URL that - when activated - will open a payment window. This is the prefered way of accepting payment in our hosted environment as it gives a number of benefits - most notably:
- Abandoned orders recovery - resume payments when the purchaser left off
- E-mail channel payments
- A Link can be repeatedly used/activated until payment is completed
Please see acquirer details for any acquirer specific requirements.
How it works
A Quickpay Link is created using the API in two small steps - First create a Payment and create a Link on that payment. You will then get an URL that you can display or send to your customer.
Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Use the official quickpay-ruby-client gem
require "quickpay/api/client"
client = QuickPay::API::Client.new(password: ENV['YOUR_API_USER_KEY'])
# /framed requests require: `allow-same-origin`, `allow-scripts` and `allow-forms` headers.
payment = client.post(
"/payments",
headers: { "Content-Type" => "application/json" },
body: { order_id: "0001", currency: "DKK" }.to_json
)
link = client.put(
"/payments/#{payment['id']}/link",
headers: { "Content-Type" => "application/json" },
body: { amount: 100 }.to_json
)
puts link['url']
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from quickpay_api_client import QPClient
secret = ':{0}'.format(os.environ['QUICKPAY_API_KEY'])
client = QPClient(secret)
payment = client.post('/payments', body={'currency': 'DKK',
'order_id': '0001'})
link = client.put('/payments/%s/link' % payment['id'],
body={'amount': 100})
# Add framed=true if you want to open in an iframe
print link['url']
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use QuickPay\QuickPay;
try {
//Initialize client
$client = new QuickPay(":api-key-here");
//Create payment
$payment = $client->request->post('/payments', [
'order_id' => '0007',
'currency' => 'DKK',
]);
$status = $payment->httpStatus();
//Determine if payment was created successfully
if ($status === 201) {
$paymentObject = $payment->asObject();
//Construct url to create payment link
$endpoint = sprintf("/payments/%s/link", $paymentObject->id);
//Issue a put request to create payment link
$link = $client->request->put($endpoint, [
'amount' => 100 //amount in cents
]);
//Determine if payment link was created succesfully
if ($link->httpStatus() === 200) {
//Get payment link url
echo $link->asObject()->url;
}
}
} catch (\Exception $e) {
echo $e->getMessage();
}
?>