Create payment link¶
POST
https://api.mollie.com/v2/payment-links
With the Payment links API you can generate payment links that by default, unlike regular payments, do not expire. The payment link can be shared with your customers and will redirect them to them the payment page where they can complete the payment. A Get payment will only be created once the customer initiates the payment.
Parameters¶
description
stringrequiredamount
amount objectrequiredThe amount that you want to charge, e.g. {"currency":"EUR", "value":"1000.00"}
if you would want to charge
€1000.00.
currency
stringrequiredvalue
stringrequiredredirectUrl
stringoptionalwebhookUrl
stringoptionalSet the webhook URL, where we will send payment link status updates to.
The webhookUrl
is optional, but without a webhook you will miss out on important status changes about your
payment link.
The webhookUrl
must be reachable from Mollie’s point of view, so you cannot use localhost
. If you want to use
webhook during development on localhost
, you should use a tool like
ngrok to have the webhooks delivered
to your local machine.
See webhook documentation for more details.
expiresAt
datetimeoptional2021-12-24T12:00:16+01:00
.Access token parameters¶
If you are using organization access tokens or are creating an
OAuth app, the only mandatory extra parameter is the profileId
parameter. With it, you
can specify which profile the payment belongs to. Organizations can have multiple profiles for each of their websites.
See Profiles API for more information.
pfl_3RkSN1zuPE
.Response¶
201
application/hal+json
A payment link object is returned, as described in Get payment link.
Example¶
1 2 3 4 5 6 7 8 | curl -X POST https://api.mollie.com/v2/payment-links \ -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" \ --data-urlencode "amount[currency]=EUR" \ --data-urlencode "amount[value]=24.95" \ --data-urlencode "description=Bicycle tires" \ --data-urlencode "expiresAt=2023-06-06T11:00:00+00:00" \ --data-urlencode "redirectUrl=https://webshop.example.org/thanks" \ --data-urlencode "webhookUrl=https://webshop.example.org/payment-links/webhook/" |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"); $paymentLink = $mollie->paymentLinks->create([ "amount" => [ "currency" => "EUR", "value" => "24.95", ], "description" => "Bicycle tires", "expiresAt" => "2023-06-06T11:00:00+00:00", "redirectUrl" => "https://webshop.example.org/thanks", "webhookUrl" => "https://webshop.example.org/payment-links/webhook/", ]); $paymentLink->getCheckoutUrl(); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from mollie.api.client import Client mollie_client = Client() mollie_client.set_api_key("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM") payment_link = mollie_client.payment_links.create({ "amount": { "currency": "EUR", "value": "24.95" }, "description": "Bicycle tires", "expiresAt": "2023-06-06T11:00:00+00:00", "webhookUrl": "https://webshop.example.org/payment-links/webhook/", "redirectUrl": "https://webshop.example.org/thanks", }) |
1 2 3 4 | We don't have a Ruby code example for this API call yet. If you have some time to spare, feel free to share suggestions on our Discord: https://discord.gg/VaTVkXB4aQ |
1 2 3 4 | We don't have a Node.js code example for this API call yet. If you have some time to spare, feel free to share suggestions on our Discord: https://discord.gg/VaTVkXB4aQ |
Response¶
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 | HTTP/1.1 201 Created Content-Type: application/hal+json { "resource": "payment-link", "id": "pl_4Y0eZitmBnQ6IDoMqZQKh", "mode": "test", "profileId": "pfl_QkEhN94Ba", "createdAt": "2021-03-20T09:13:37+00:00", "paidAt": null, "updatedAt": null, "expiresAt": "2023-06-06T11:00:00+00:00", "amount": { "value": "24.95", "currency": "EUR" }, "archived": false, "description": "Bicycle tires", "redirectUrl": "https://webshop.example.org/thanks", "webhookUrl": "https://webshop.example.org/payment-links/webhook/", "_links": { "self": { "href": "https://api.mollie.com/v2/payment-links/pl_4Y0eZitmBnQ6IDoMqZQKh", "type": "application/json" }, "paymentLink": { "href": "https://paymentlink.mollie.com/payment/4Y0eZitmBnQ6IDoMqZQKh/", "type": "text/html" }, "documentation": { "href": "https://docs.mollie.com/reference/v2/payment-links-api/create-payment-link", "type": "text/html" } } } |