Introduction to Payments
Create and authorize payment
1. Create a new payment
First 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":"pm1001","currency":"dkk"}' \
https://api.quickpay.net/payments
Example response (snippet):
1
2
3
4
5
6
7
8
9
{
"id":99685196,
"merchant_id":1234,
"order_id":"pm1001",
"type":"Payment",
"currency":"DKK",
"state":"initial"
...
}
2. Authorize payment using a link
Next step is to authorize the payment.
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 |
amount | Amount to authorize | form | integer | true |
Example request:
1
2
3
4
5
6
curl -u ':APIKEY' \
-H 'content-type:application/json' \
-H 'Accept-Version:v10' \
-X PUT \
-d '{"amount":1000}' \
https://api.quickpay.net/payments/99685196/link
Example response:
1
2
3
{
"url":"https://payment.quickpay.net/payments/b4674ca58c6c8a2afeea105fb1b5ca22293a1dc17fa852afa0495010999c2d00"
}
When your customer has filled in the card information using the link, the payment is now authorized.
No funds are withdrawn from your customer yet.
If you are selling a digital products, you can include "auto_capture":"true"
in the payment link request, to capture the payment automatically after the authorize.
If you are selling a physical product, you can capture the payment using POST /payments/{id}/capture when you are ready to ship the product.
3. Check payment status
Last step is to check the status of the payment.
This could be on a continue-url, where you render a “Payment successful”-message when the payment is complete.
Example request:
1
2
3
4
5
curl -u ':APIKEY' \
-H 'content-type:application/json' \
-H 'Accept-Version:v10' \
-X GET \
https://api.quickpay.net/payments/99685196
Example response (snippet):
1
2
3
4
5
6
7
8
9
{
"id":99685196,
"merchant_id":1234,
"order_id":"pm1001",
"accepted":true,
"type":"Payment",
"state":"new"
...
}