
CoolPay Link
CoolPay Link
The CoolPay 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 CoolPay 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.
Code examples
Ruby
# Use the official coolpay-ruby-client gem
require "coolpay/api/client"
client = CoolPay::API::Client.new(api_key: ENV['YOUR_API_USER_KEY'])
payment = client.post("/payments",
:order_id => "0001",
:currency => "DKK"
)
link = client.put("/payments/#{payment['id']}/link",
:amount => 100
# Add ":framed => true" if you want to open the link in an iframe
)
puts link['url']
Python
import os
from coolpay_api_client import QPClient
secret = ":{0}".format(os.environ['COOLPAY_API_KEY'])
client = QPClient(secret)
payment = client.post("/payments", order_id="0001", currency="DKK")
link = client.put("/payments/%s/link" % payment['id'], amount=100
# Add framed=true if you want to open in an iframe
)
print link['url']