Payment links
A payment link is a reusable URL. Each buyer who opens it gets a new checkout session and a new transaction. Times on payment links are epoch milliseconds.
Read Payment links for the model and the lifecycle. For a walkthrough, read Sell with payment links.
The payment link object#
A reusable link that creates a checkout session for each buyer. Times are epoch milliseconds.
Attributes
- idstring
- objectTypestring
- accountIdstring
- titlestring
The title of the link.
- amountSourceobject
Exactly one amount source.
modeselects the source. Fields of another source are refused. All money is in minor units.Child attributes of
amountSource- modestring
catalog_itemssells catalog prices,fixed_amountsells one amount, andbuyer_entered_amountlets the buyer choose within a range.One of:
catalog_items,fixed_amount,buyer_entered_amount - currencystring
An ISO 4217 alphabetic currency code.
Pattern
^[A-Z]{3}$. The catalog prices and quantities of a
catalog_itemssource.At most 100 items.
Lets the buyer change the quantity of a
catalog_itemssource.Default
false.The amount of a
fixed_amountsource.At least 1.
The lowest accepted amount of a
buyer_entered_amountsource.At least 1.
The highest accepted amount, when a limit exists.
At least 1.
Suggested amounts. Each must be positive and within the range.
- urlstring (URL)
The buyer-facing link on the checkout host.
- successUrlstring (URL)
- cancelUrlstring (URL)
- usageCountinteger
How many sessions the link has created.
- activeboolean
- createdAtinteger
The response can include fields that this page does not list. Ignore fields that you do not know.
Create a payment link#
POST/
Creates an active payment link. Each time a buyer opens the link, Merxian creates a new checkout session and a new draft transaction.
A link has exactly one amount source: catalog items, a fixed amount, or an amount that the buyer enters.
Requires the checkout:write scope.
Headers
A unique key for this request, at most 200 characters. A retry with the same key and body returns the first result.
At most 200 characters.
Request body
The title of the link.
At least 1 character.
- descriptionstring
Exactly one amount source.
modeselects the source. Fields of another source are refused. All money is in minor units.Child attributes of
amountSourcecatalog_itemssells catalog prices,fixed_amountsells one amount, andbuyer_entered_amountlets the buyer choose within a range.One of:
catalog_items,fixed_amount,buyer_entered_amountAn ISO 4217 alphabetic currency code.
Pattern
^[A-Z]{3}$.- lineItemsarray of objects
The catalog prices and quantities of a
catalog_itemssource.At most 100 items.
- allowQuantityEditsboolean
Lets the buyer change the quantity of a
catalog_itemssource.Default
false. - amountMinorinteger
The amount of a
fixed_amountsource.At least 1.
- minimumAmountMinorinteger
The lowest accepted amount of a
buyer_entered_amountsource.At least 1.
- maximumAmountMinorinteger
The highest accepted amount, when a limit exists.
At least 1.
- suggestedAmountsMinorarray of integers
Suggested amounts. Each must be positive and within the range.
Must be
https, except for a localhost URL in local development.At most 2048 characters.
At most 2048 characters.
- usageLimitinteger
How many sessions the link may create. No limit when absent.
At least 1.
- expiresAtinteger
When the link stops working, in epoch milliseconds. Must be in the future.
Returns
Errors
| Status | Meaning |
|---|---|
| 400 | The request is not valid. See the error body for the field at fault. |
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 409 | The request conflicts with the current state of the resource, or the idempotency key was used with a different request. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.
Retrieve a payment link#
GET/
Requires the checkout:read scope.
Path parameters
The payment link id.
Returns
Errors
| Status | Meaning |
|---|---|
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 404 | The resource does not exist, or it belongs to another account. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.
List payment links#
GET/
Returns one page of your payment links, newest first.
Requires the checkout:read scope.
Query parameters
- limitinteger
How many links to return. A value outside 1-100 fails with
400.1 to 100. Default
20. - cursorstring
An opaque cursor taken from a previous response's
pagination.nextCursor.
Returns
200A page of payment link objects, in data, with pagination.
Errors
| Status | Meaning |
|---|---|
| 400 | The request is not valid. See the error body for the field at fault. |
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.
Update a payment link#
PATCH/
Changes the fields that you send and keeps the others. An absent or null field keeps its value, so you cannot clear a field. An amountSource replaces the full amount source and must be complete.
Requires the checkout:write scope.
Path parameters
The payment link id.
Headers
A unique key for this request, at most 200 characters. A retry with the same key and body returns the first result.
At most 200 characters.
Request body
- titlestring
- descriptionstring
- amountSourceobject
Exactly one amount source.
modeselects the source. Fields of another source are refused. All money is in minor units.Child attributes of
amountSourcecatalog_itemssells catalog prices,fixed_amountsells one amount, andbuyer_entered_amountlets the buyer choose within a range.One of:
catalog_items,fixed_amount,buyer_entered_amountAn ISO 4217 alphabetic currency code.
Pattern
^[A-Z]{3}$.- lineItemsarray of objects
The catalog prices and quantities of a
catalog_itemssource.At most 100 items.
- allowQuantityEditsboolean
Lets the buyer change the quantity of a
catalog_itemssource.Default
false. - amountMinorinteger
The amount of a
fixed_amountsource.At least 1.
- minimumAmountMinorinteger
The lowest accepted amount of a
buyer_entered_amountsource.At least 1.
- maximumAmountMinorinteger
The highest accepted amount, when a limit exists.
At least 1.
- suggestedAmountsMinorarray of integers
Suggested amounts. Each must be positive and within the range.
- successUrlstring (URL)
At most 2048 characters.
- cancelUrlstring (URL)
At most 2048 characters.
- usageLimitinteger
At least 1.
- activeboolean
- expiresAtinteger
Epoch milliseconds.
Returns
Errors
| Status | Meaning |
|---|---|
| 400 | The request is not valid. See the error body for the field at fault. |
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 404 | The resource does not exist, or it belongs to another account. |
| 409 | The request conflicts with the current state of the resource, or the idempotency key was used with a different request. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.
Activate a payment link#
POST/
Lets the link create checkout sessions again.
Requires the checkout:write scope.
Path parameters
The payment link id.
Headers
A unique key for this request, at most 200 characters. A retry with the same key and body returns the first result.
At most 200 characters.
Returns
Errors
| Status | Meaning |
|---|---|
| 400 | The request is not valid. See the error body for the field at fault. |
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 404 | The resource does not exist, or it belongs to another account. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.
Deactivate a payment link#
POST/
Stops the link from creating checkout sessions. Sessions that the link already created stay usable.
Requires the checkout:write scope.
Path parameters
The payment link id.
Headers
A unique key for this request, at most 200 characters. A retry with the same key and body returns the first result.
At most 200 characters.
Returns
Errors
| Status | Meaning |
|---|---|
| 400 | The request is not valid. See the error body for the field at fault. |
| 401 | The API key is missing, malformed, revoked, or unknown. |
| 403 | The API key does not hold the scope that this operation requires. |
| 404 | The resource does not exist, or it belongs to another account. |
| 500 | An unexpected error occurred. Retry with the same idempotency key. |
| 502 | Merxian could not complete the request. Retry with the same idempotency key. |
| 503 | Merxian could not verify the API key. Retry later. |
The error reference lists the codes in each error body.