Create a link
The easiest way is the dashboard: Payments → Payment links. You can also create links with the API. Link management uses a merchant session token, not the secret key, because it is a dashboard operation.data.paymentLinkUrl. The URL shown is abbreviated here. Use the exact value the response returns for the environment you called.
Link fields
Metadata is a form, not an echo
On a payment link,metadata defines the prompts the customer completes before checkout starts. It is an object whose keys are your field names and whose values describe each prompt, with a label, a type such as email or text, whether it is required, and an optional placeholder. Vestrapay adds a stable id to each prompt, and the customer’s answers are keyed by that ID.
This differs from the metadata object you send on initialise, which is opaque correlation data returned on verify. Do not confuse the two.
Fixed amounts, open amounts and splits
- Fixed amount. The link always charges that amount.
- Open amount. The customer enters the amount at checkout. If the link also has a distribution, the amount they enter must be at least the sum of the distribution amounts, otherwise the payment is rejected.
- With splits. A distribution on the link is applied on every payment, so the split happens without any code on your side. If a service named in the distribution is later disabled, paying through the link is rejected until you fix the link or re-enable the service.
Manage links
All of these use the merchant session token.
Update accepts the same fields as create, plus
status, which you can set to active or paused to switch a link off and on without deleting it. Links can also become expired or exhausted. Those states are managed by the system and cannot be set manually. Omit distribution or metadata from an update to leave the existing values as they are.
A paused, expired or exhausted link returns HTTP 410 with payment_link.inactive to anyone who opens it.
What the customer does
- Opens the link.
- Completes any prompts you configured.
- Vestrapay initialises checkout for that link.
- The customer pays on hosted checkout.
- You confirm with webhooks and verify.
The display response contains the title, amount, currency, merchant name, environment and the prompts, each with its generated
id. The pay request carries the answers keyed by those IDs, and an amount when the link is open-amount:
data.checkoutUrl:
Reconciling link payments
A link payment is an ordinary transaction with its own reference. Your webhook receives the same events, and verify returns the same data, so your fulfilment code does not need a separate path. Use the answers you collected, such as an order ID prompt, to match the payment to your records, since there is no initialise call of your own to attach metadata to.Failure modes
See Errors for the full list.