Introduction to Saved Cards

Saved Cards have two seperate use-cases

a) 1-click-payments for returning customers. With Saved Cards you can offer your customers a lot of convenience with QuickPay Saved Cards. With this feature your customesr will only have to authorize their credit card once - after that they can pay without filling in their payment details.

Please note that Saved Cards can not currently be used for “1-click-payments” because of the PSD2 regulations. Read more in the PSD2 section below.

b) Non-scheduled recurring payments. While [subscriptions] are meant for scheduled recurring payments, in some cases you want to accept recurring payments from your customers, that are not scheduled.


PSD2

Saved Cards are currently only available for non-scheduled recurring payments, where the cardholder is not present. Read more on PSD2 and QuickPay

We expect Saved Cards to be available for “1-click-payments” again during 2021.


Create and authorize card

  1. Create a new card
  2. Authorize card using a link
  3. Create token

Use the card to complete a payment

  1. Create a new payment
  2. Authorize payment using the token

Examples

Implementation Example


1. Create a new card in QuickPay

POST /cards Create saved card

First step is to create a new card entity in QuickPay.

Example request:

1
2
3
4
5
curl -u ':APIKEY' \
     -H 'content-type:application/json' \
     -H 'Accept-Version:v10' \
     -X POST \
     https://api.quickpay.net/cards

Example response (snippet):

1
2
3
4
5
{
  "id":2886958,
  "merchant_id":1234
  ...
}
PUT /cards/{id}/link Create or update a card link

Next step is to authorize the card.

The recommended way is to request the QuickPay API for a payment link, where your customer can fill in their card information.

Selected parameters. See more in the API documentation.

Parameter Description Parameter type Data type Required?
id Transaction id path integer true

Example request:

1
2
3
4
5
curl -u ':APIKEY' \
     -H 'content-type:application/json' \
     -H 'Accept-Version:v10' \
     -X PUT \
     https://api.quickpay.net/cards/2886958/link

Example response:

1
2
3
{
  "url":"https://payment.quickpay.net/cards/b4674ca58c6c8a2afeea105fb1b5ca22293a1dc17fa852afa0495010999c2d00"
}

When your customer has filled in the card information using the link, the saved card is now authorized.

No funds are withdrawn from your customer yet.

3. Create token

POST /cards/{id}/tokens Create card token

As of now the customers card is authorized, but no funds have been withdrawed from their account.

Each time the card should be used, your system request the QuickPay API for a token from the Saved Card.

This token can be used once to authorize a payment, subscription or payout.

Example request:

1
2
3
4
5
curl -u ':APIKEY' \
     -H 'content-type:application/json' \
     -H 'Accept-Version:v10' \
     -X POST \
     https://api.quickpay.net/cards/2886958/tokens

Example response (snippet):

1
2
3
4
5
6
{
  "token":"b1467a5e-9927-4574-a065-e704144faae6",
  "is_used":false,
  "created_at":"2017-10-25T13:16:24Z"
  ...
}

The token can now be used to complete a payment, subscription or payout.

1. Create a new payment

POST /payments Create payment

Next step is to create a payment entity in QuickPay

Selected parameters. See more in the API documentation.

Parameter Description Parameter type Data type Required?
order_id Unique order number form string true
currency Currency form string true

Example request:

1
2
3
4
5
6
curl -u ':APIKEY \
     -H 'content-type:application/json' \
     -H 'Accept-Version:v10' \
     -X POST \
     -d '{"order_id":"test1ab","currency":"dkk"}' \
     https://api.quickpay.net/cards

Example response (snippet):

1
2
3
4
5
6
7
8
9
10
{
  "id":98648340,
  "merchant_id":1234,
  "order_id":"test1ab",
  "accepted":false,
  "type":"Payment",
  "currency":"DKK",
  "state":"initial"
  ...
}

2. Authorize payment using the token

POST /payments/{id}/authorize Authorize payment

Final step is to authorize the payment using the card token created in step 3.

Selected parameters. See more in the API documentation.

Parameter Description Parameter type Data type Reqired?
id Transaction id path integer true
card[token] Card token form string false

Example request:

1
2
3
4
5
6
7
curl -u ':APIKEY' \
     -H 'content-type:application/json' \
     -H 'Accept-Version:v10' \
     -X POST \
     -d '{"card":{"token":"b1467a5e-9927-4574-a065-e704144faae6"},
          "amount":1000}'
     https://api.quickpay.net/payment/98648340/authorize

Example response (snippet):

1
2
3
4
5
6
7
8
{
  "id":98648340,
  "merchant_id":1234,
  "order_id":"test1ab",
  "accepted":false,
  "state":"pending"
  ...
}

In the response the payments state is pending, as the authorize is not yet approved or rejected by your acquirer.

Use GET /payments/98648340 to check the payment status, by looking at the accepted parameter.


Implementation Example

Authorizing the credit card

Accepting payments using the saved card

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Use the official quickpay-ruby-client gem
require "quickpay/api/client"
client = QuickPay::API::Client.new(password: ENV["QUICKPAY_API_KEY"])

tokens  = client.post("/cards/#{card['id']}/tokens")

payment = client.post(
  "/payments",
  headers: { "Content-Type" => "application/json" },
  body: {
    order_id: "0001",
    currency: "DKK"
  }.to_json
)

authorize = client.post(
  "/payments/#{payment['id']}/authorize",
  headers: { "Content-Type" => "application/json" },
  query: { "synchronized" => "" },
  body: {
    amount: 100,
    card: { token: tokens['token'] }
  }.to_json
)
1
2
3
4
5
6
7
8
9
10
# Use the official quickpay-python-client module
from quickpay_api_client import QPClient
secret = ":{0}".format(os.environ['QUICKPAY_API_KEY'])
client = QPClient(secret)

tokens    = client.post("/cards/%s/tokens" % card['id'])
payment   = client.post("/payment", body={'currency':"DKK", 'order_id': "0001"})
authorize = client.post("/payments/%s/authorize?synchronized" % payment['id'],
                        body={'amount=100'},
                        card={"token": tokens['token']})