PayRequest Documentation

PayRequest API

Simple HTTP api (HTTP Requests)
Written by PayRequest Team
Updated 1 month ago
Looking for the (deprecated) V1 API? Click here!

Introduction

The Payrequest API is created with simplicity in mind. Cost (and time) efficient 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 or will clearly state if otherwise.

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

At the moment our API only supports stripe connected accounts!

Token

Your token can be found in your dashboard. After you login navigate to Settings and click on API. You will see your API key which you can copy very easily by clicking on the small copy icon.

The copy button

URL

In previous releases of the API we talked about link.payrequest.io as our API url. Since this confused some clients we changed that. Your API can be accessed on api.payrequest.io

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

Customers

In our API you won't need to add a seperate  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 successfull you will receive a JSON response where each entry in the array reflects a customer. Below you can see an example:

Keep notice! We plan on integrating pagination and max per page. Subscribe to get notified on API updates.
[
    {
        'id': 123,
        'name':'Jane Doe',
        'email':'jane.d@example.com',
        'note':'Always pays straight away',
        'country':'DE',
        'phone':'0123 4568 8910'
    },
    {
        'id': 124,
        'name':'John Doe',
        'email':'john.d@example.com',
        'note':'Tend to forget, always enable payment reminder!',
        'country':'DE',
        'phone':'0123 4568 8910'
    }
]

Payments

You can get all payments or get information about a certain one.

Get all

POST /payments

Attributes

Attribute
Required
Information
token Yes The token ( V2 API ) you get from your dashboard.

Response

If the response is successfull 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: personallink, paymentlink, paymentplan, pre-auth and donation.
Keep notice! We plan on integrating pagination and max per page. Subscribe to get notified on API updates.
{
    'status':'success',
    'payments':[{
        'id':5284,
        'amount':'55.490',
        'name':'John Doe',
        'email':'info@payrequest.io',
        'note':'',
        'paidat':'2021-8-3T10:30:22O',
        'type':'personallink',
        'linkid':'79bkqdt'
    },
    {
        'id':5285,
        'amount':'25.99',
        'name':'Jane Doe',
        'email':'info@payrequest.io',
        'note':'gouden ideeën',
        'paidat':'2021-8-3T14:31:14O',
        'type':'paymentlink',
        'linkid':'796qciu'
    }],
    'length':2
}

Get payments of object

Get all payments of object. This can be all types mentioned above.

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 successfull you will receive a JSON response where each entry in the array reflects a payment.

{
    'status':'success',
    'payments':[{
        'id':5284,
        'amount':'55.490',
        'name':'John Doe',
        'email':'info@payrequest.io',
        'note':'',
        'paidat':'2021-8-3T10:30:22O',
        'type':'personallink',
        'linkid':5141
    },
    {
        'id':5285,
        'amount':'25.99',
        'name':'Jane Doe',
        'email':'info@payrequest.io',
        'note':'gouden ideeën',
        'paidat':'2021-8-3T14:31:14O',
        'type':'personallink',
        'linkid':5141
    }],
    'length':2
}

Requests

Create

One simple call to create all sort of requests. The response depends if you have given the return variable. 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 you 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
  • paymentplan
  • pre-auth
  • donation
planid Only if paymentplan

The id of a paymentplan.

title Yes
( not for paymentplan )
Payment title that's clear to you and your customer.
amount

Yes
( not for paymentplan )

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 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 customers browser.
  • If no set or not set to direct an API response will be created.
response No If given the customer will be redirect 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 No Your facebook url.
Only used in:
paymentlink, pre-auth & donation
instagram No Your instagram url.
Only used in: paymentlink, pre-auth & donation
youtube No Your youtube url.
Only used in: paymentlink, pre-auth & donation
twitter No Your twitter url.
Only used in: paymentlink, pre-auth & donation
website 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 a 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.


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.


Roadmap

We keep expanding our API and have various ideas what to include.

  1. /getpaymentplans Get all Payment plans so it will be easier to get the ID of a plan.
  2. /subscriptions/all Get all subscriptions.
  3. /subscriptions/get Get a specific subscription and check details and status.
  4. /subscriptions/cancel Cancel a certain subscription.
  5. /subscriptions/pause Pauze a certain subscription.
  6. /subscriptions/resume Resume a paused subscription.

Got some ideas?

Please let us know by chatting with us by clicking on the icon in the right bottom corner!

Did this answer your question?