Skip to content

Create a payment link

POST
/payment-links
curl --request POST \
--url https://api.paywithnablr.com/v1/payment-links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "Jollof rice tray", "description": "Serves 10. Delivery in Lagos only.", "amount": 2500000, "collect": [ "phone", "address" ] }'
Media typeapplication/json
object
name
required
string
>= 1 characters <= 120 characters
description
string
<= 500 characters
amount

A fixed amount in kobo, at least ₦100 (10000). null or omitted lets the customer choose (₦100 to ₦10,000,000).

integer | null format: int64
>= 10000
currency
string
default: NGN
Allowed values: NGN
single_use

Turn the link off after its first successful payment.

boolean
redirect_url

Where to send the customer after paying (the payment’s callback_url).

string format: uri
<= 2000 characters
collect

Extra details to ask the customer for.

Array<string>
Allowed values: phone address
Example
{
"name": "Jollof rice tray",
"description": "Serves 10. Delivery in Lagos only.",
"amount": 2500000,
"collect": [
"phone",
"address"
]
}

The link. Share url.

Media typeapplication/json
object
data
required
object
id
required
string
object
required
string
Allowed value: payment_link
slug
required
string
url
required

The page to share.

string
name
required
string
description
required
string | null
amount
required

null: the customer chooses.

integer | null format: int64
currency
required
string
Allowed values: NGN
single_use
required
boolean
redirect_url
required
string | null
collect
required
Array<string>
Allowed values: phone address
active
required
boolean
mode
required
string
Allowed values: test live
payments_count
required

Succeeded payments through the link.

integer
volume
required

Their total, in kobo.

integer format: int64
last_paid_at
required
string | null format: date-time
created_at
required
string format: date-time
updated_at
required
string format: date-time
meta
required
object
request_id
required

This request’s id, also in the X-Request-Id header.

string
Example
{
"data": {
"id": "lnk_01M3XXC0D1E2F3G4H5J6K7M8N9",
"object": "payment_link",
"slug": "jollof-rice-tray-k3m9",
"url": "https://pay.paywithnablr.com/l/jollof-rice-tray-k3m9",
"name": "Jollof rice tray",
"currency": "NGN",
"collect": [
"phone"
],
"mode": "test"
}
}
Location
string

The link’s URL, /v1/payment-links/{id}.

VALIDATION_FAILED: a field is wrong; details says which. A value of the wrong JSON type has detail code type and a message saying what to send (Send a whole number., Send text., Send true or false., Send an object., Send a list.). MALFORMED_REQUEST: the body is not valid JSON.

Media typeapplication/json
object
error
required
object
message
required

A sentence for a person. Safe to show to your user.

string
code
required
string
Allowed values: VALIDATION_FAILED MALFORMED_REQUEST UNAUTHENTICATED INVALID_API_KEY SECRET_KEY_REQUIRED LIVE_MODE_NOT_ENABLED ACCOUNT_RESTRICTED TEST_MODE_ONLY NOT_FOUND METHOD_NOT_ALLOWED CONFLICT DUPLICATE_REFERENCE IDEMPOTENCY_KEY_REUSED REQUEST_IN_PROGRESS INVALID_STATE_TRANSITION PAYLOAD_TOO_LARGE UNSUPPORTED_MEDIA_TYPE RATE_LIMITED INTERNAL_ERROR SERVICE_UNAVAILABLE
title
required

The code in words, for example Validation failed.

string
reference

A quotable reference for some failures.

string
details

One entry per field that is wrong.

Array<object>
object
field
required
string
code
required

For example required, invalid, format, length, unknown, type.

string
message
required
string
meta

Extra context, such as retry_after_seconds on RATE_LIMITED.

object
key
additional properties
any
meta
required
object
request_id
required

This request’s id, also in the X-Request-Id header.

string
Example
{
"error": {
"message": "Send a positive amount in minor units (500000 = ₦5,000.00).",
"code": "VALIDATION_FAILED",
"title": "Validation failed",
"details": [
{
"field": "amount",
"code": "invalid",
"message": "Send a positive amount in minor units (500000 = ₦5,000.00)."
}
]
},
"meta": {
"request_id": "01a0fbd4-3b18-7181-9149-8dbcae100085"
}
}

UNAUTHENTICATED: no Authorization: Bearer header. The message says what to send: your secret key (Bearer sk_test_… or sk_live_…). INVALID_API_KEY: the key is unknown, malformed or revoked.

Media typeapplication/json
object
error
required
object
message
required

A sentence for a person. Safe to show to your user.

string
code
required
string
Allowed values: VALIDATION_FAILED MALFORMED_REQUEST UNAUTHENTICATED INVALID_API_KEY SECRET_KEY_REQUIRED LIVE_MODE_NOT_ENABLED ACCOUNT_RESTRICTED TEST_MODE_ONLY NOT_FOUND METHOD_NOT_ALLOWED CONFLICT DUPLICATE_REFERENCE IDEMPOTENCY_KEY_REUSED REQUEST_IN_PROGRESS INVALID_STATE_TRANSITION PAYLOAD_TOO_LARGE UNSUPPORTED_MEDIA_TYPE RATE_LIMITED INTERNAL_ERROR SERVICE_UNAVAILABLE
title
required

The code in words, for example Validation failed.

string
reference

A quotable reference for some failures.

string
details

One entry per field that is wrong.

Array<object>
object
field
required
string
code
required

For example required, invalid, format, length, unknown, type.

string
message
required
string
meta

Extra context, such as retry_after_seconds on RATE_LIMITED.

object
key
additional properties
any
meta
required
object
request_id
required

This request’s id, also in the X-Request-Id header.

string
Example
{
"error": {
"message": "The API key provided is not valid.",
"code": "INVALID_API_KEY",
"title": "Invalid API key"
},
"meta": {
"request_id": "01a0fbd4-3b68-75e0-bd33-0b950ddc99a5"
}
}

SECRET_KEY_REQUIRED: you sent a publishable key. LIVE_MODE_NOT_ENABLED: a live key before your business is verified. ACCOUNT_RESTRICTED: the account is suspended.

Media typeapplication/json
object
error
required
object
message
required

A sentence for a person. Safe to show to your user.

string
code
required
string
Allowed values: VALIDATION_FAILED MALFORMED_REQUEST UNAUTHENTICATED INVALID_API_KEY SECRET_KEY_REQUIRED LIVE_MODE_NOT_ENABLED ACCOUNT_RESTRICTED TEST_MODE_ONLY NOT_FOUND METHOD_NOT_ALLOWED CONFLICT DUPLICATE_REFERENCE IDEMPOTENCY_KEY_REUSED REQUEST_IN_PROGRESS INVALID_STATE_TRANSITION PAYLOAD_TOO_LARGE UNSUPPORTED_MEDIA_TYPE RATE_LIMITED INTERNAL_ERROR SERVICE_UNAVAILABLE
title
required

The code in words, for example Validation failed.

string
reference

A quotable reference for some failures.

string
details

One entry per field that is wrong.

Array<object>
object
field
required
string
code
required

For example required, invalid, format, length, unknown, type.

string
message
required
string
meta

Extra context, such as retry_after_seconds on RATE_LIMITED.

object
key
additional properties
any
meta
required
object
request_id
required

This request’s id, also in the X-Request-Id header.

string
Example
{
"error": {
"message": "This request needs your secret key. Publishable keys can only be used from a checkout.",
"code": "SECRET_KEY_REQUIRED",
"title": "Secret key required"
},
"meta": {
"request_id": "01a0fbd4-3b68-75e0-bd33-0b950ddc99a5"
}
}

RATE_LIMITED: wait Retry-After seconds, then retry.

Media typeapplication/json
object
error
required
object
message
required

A sentence for a person. Safe to show to your user.

string
code
required
string
Allowed values: VALIDATION_FAILED MALFORMED_REQUEST UNAUTHENTICATED INVALID_API_KEY SECRET_KEY_REQUIRED LIVE_MODE_NOT_ENABLED ACCOUNT_RESTRICTED TEST_MODE_ONLY NOT_FOUND METHOD_NOT_ALLOWED CONFLICT DUPLICATE_REFERENCE IDEMPOTENCY_KEY_REUSED REQUEST_IN_PROGRESS INVALID_STATE_TRANSITION PAYLOAD_TOO_LARGE UNSUPPORTED_MEDIA_TYPE RATE_LIMITED INTERNAL_ERROR SERVICE_UNAVAILABLE
title
required

The code in words, for example Validation failed.

string
reference

A quotable reference for some failures.

string
details

One entry per field that is wrong.

Array<object>
object
field
required
string
code
required

For example required, invalid, format, length, unknown, type.

string
message
required
string
meta

Extra context, such as retry_after_seconds on RATE_LIMITED.

object
key
additional properties
any
meta
required
object
request_id
required

This request’s id, also in the X-Request-Id header.

string
Example
{
"error": {
"message": "Too many attempts. Please wait a moment and try again.",
"code": "RATE_LIMITED",
"title": "Rate limited",
"meta": {
"retry_after_seconds": 12
}
},
"meta": {
"request_id": "01a0fbd4-3b68-75e0-bd33-0b950ddc99a5"
}
}
Retry-After
integer

Seconds to wait.

X-RateLimit-Reset
integer

Unix time when a request will be allowed again.