Looking for the (deprecated) V1 API? Click here!

Introduction & foreword

The PayRequest API is created with simplicity in mind. Cost (and time) efficiency to get you where you want to be! Our API works with POST variables but will also work if you send your variables JSON-encoded in the body. We will return JSON-encoded responses ( if not stated otherwise ).

Authentication will be done with an API key which we will call token.

Token

Your token can be found in your dashboard. After you log in, navigate to Settings => API. You will see your API keys which you can copy very easily by clicking on the small copy icon.

URL

In previous releases of our API we've used link.payrequest.io as our API URL. Since this confused some clients we changed it.
Your API can be accessed on api.payrequest.io.

Don't forget to include https:// on your real calls!
We don't do that here since it makes everything very chaotic in the documentation.


API Calls

Get all customers

In our API you won't need to add a separate customer. We will do that for you! However, if you want to get all your customers you can use the next call.

POST /customers


Attributes

Attribute

Required

Information

token

Yes

The token ( V2 API ) you get from your dashboard.

Response

If the response is successful you will receive a JSON response where each entry in the array reflects a customer. Below you can see an example:

[
{
"id":123,
"name":"Jane Doe",
"email":"[email protected]",
"note":"Always pays straight away",
"country":"DE",
"phone":"0123 4568 8910"
},
{
"id":124,
"name":"John Doe",
"email":"[email protected]",
"note":"Tend to forget, always enable payment reminder!",
"country":"DE",
"phone":"0123 4568 8910"
}
]

Notice! There's no pagination at the moment, we expect to implement that in Q1 2023 and can be enabled in your request ( ensuring old code keeps working ).


Payments

Get all

Get all payments you ever received in one call.

POST /payments

Attributes

Attribute

Required

Information

token

Yes

The token ( V2 API ) you get from your dashboard.

Response

If the response is successful you will receive a JSON response where each entry in the array reflects a payment.
We return all payments at once, so the payload could be a little big.

You can get multiple payment types: personal link, payment link, products, subscriptions, pre-auth, and donation.

{
"status":"success",
"payments":[
{
"id":5284,
"amount":"55490",
"currency":"USD",
"name":"John Doe",
"email":"[email protected]",
"note":"",
"paidat":"2021-8-3T10:30:22O",
"type":"personallink",
"linkid":"79bkqdt"
},
{
"id":5285,
"amount":"25.99",
"currency":"EUR",
"name":"Jane Doe",
"email":"[email protected]",
"note":"gouden ideeën",
"paidat":"2021-8-3T14:31:14O",
"type":"paymentlink",
"linkid":"796qciu"
}
],
"length":2
}

Notice! There's no pagination at the moment, we expect to implement that in Q1 2023 and can be enabled in your request ( ensuring old code keeps working ).

Get Payments of object

Get payments for a certain object.

POST /get

Attributes

Attribute

Required?

Information

token

Yes

The token ( V2 API ) you get from your dashboard.

id

Yes

ID of object which can be gathered from /create return or from payments.

type

Yes

What type of link do you want?
Possibilities:

  • personallink

  • paymentlink

  • paymentplan

  • pre-auth

  • donation

last

No

If set to 1 we will only return the last payment of this object.

Response

If the response is successful you will receive a JSON response where each entry in the array reflects a payment.

{
"status":"success",
"payments":[
{
"id":5284,
"amount":"55.490",
"currency":"USD",
"name":"John Doe",
"email":"[email protected]",
"note":"",
"paidat":"2021-8-3T10:30:22O",
"type":"personallink",
"linkid":5141
},
{
"id":5285,
"amount":"25.99",
"currency":"EUR",
"name":"Jane Doe",
"email":"[email protected]",
"note":"gouden ideeën",
"paidat":"2021-8-3T14:31:14O",
"type":"personallink",
"linkid":5141
}
],
"length":2
}

Requests

Create

One simple call to create all sorts of requests. The response depends on the return variable ( or the lack of one ). You can redirect your user to the link and they will finish their payment and safely return to your app/website or other solution.
First, let's create the request.

POST /create

Attributes

Attribute

Required

Information

token

Yes

The token ( V2 API ) you get from your dashboard.

type

Yes

Type of request.
Possibilities:

  • paymentlink

  • product

  • pre-auth

  • donation

productid

Only if product

The id of a product.

title

Yes
( not for product )

Payment title that's clear to you and your customer.

amount

Yes
( not for product )

The amount you want to charge your customer. Or your goal for donations.

name

No

Name of the person that gets the payment link

email

No

Email of the person that gets the payment link

description

No

The description that's set in the notes

return

No

  • If return is set to direct the call will redirect directly to the request. This should only be used if you use POST with your customer's browser.

  • If no set or not set to direct an API response will be created.

response

No

If given the customer will be redirected to that page after their payment or pre-auth.

testmode

No

If given and set to 1 the link will be in test mode.

schedule

No

If given your customer will receive a reminder when the request isn't paid in time.
Possible values:

  • 1d ( 1 day )

  • 2d ( 2 days )

  • 1w ( 1 week )

  • 1m ( 1 month)

scheduleamount

Yes if schedule given

How many times can we remind your customer? Capped at 999 times.

facebook (DEPRECATED)

No

Your facebook url.
Only used in: paymentlink, pre-auth & donation

instagram (DEPRECATED)

No

Your instagram url.
Only used in: paymentlink, pre-auth & donation

youtube (DEPRECATED)

No

Your youtube url.
Only used in: paymentlink, pre-auth & donation

twitter (DEPRECATED)

No

Your twitter url.
Only used in: paymentlink, pre-auth & donation

website (DEPRECATED)

No

Your website url.
Only used in: paymentlink, pre-auth & donation

Response

{
"status":"success",
"id":"ca44m7a1b",
"url":"https://link.payrequest.io/ca44m7a1b"
}

After a payment

If you have given response, after the payment has been successful or failed the customer will be redirected to your given response URL. The URL will have 2 GET variables attached.

response The value of this will consist of MD5 encryption of status+linkid.
Example: success793mjff or failed793mjff.

return_id To perform an extra check we attached return_id which will consist a MD5 encryption of the V2 API token+linkid.

Notice! With our current system and products this call is due for a revision, this will be expected in Q1 2023. We won't overwrite this call but rather create a new call or extra variable.


Errors

Sometimes you can forget some information. We tried our best to make this as easy as possible for you. An error response will look like this:

{
"status":"error",
"error":"notoken"
}

Possible error codes:

error

Description

notoken

The token is not provided.

novalidtoken

No valid token is provided.

nosuchlink

When retrieving specific requests, there is no result found.

missingid

Linkid is not provided.

missingtype

Type is not provided or invalid.

missingplan

Planid is not provided or invalid.

notitle

No payment title is provided.

noamount

No amount is provided.

notvalidamount

No valid amount is provided.

nointegration

No PSP has been connected, or onboarding isn't finished.

pspnotsupported

Connected PSP is not supported yet in our API.

unknown

An unknown error has been generated.
Please check realerror to see what the exception error is.


Got some ideas?

Please let us know by chatting with us by clicking on the icon in the right bottom corner or mail us at [email protected]!

Did this answer your question?