Crypto checkout integration API

Crypto checkout Integration Required

For your work you will need

  • Create account or login on https://app.plasmapay.com

  • Pass KYC verification on https://app.plasmapay.com/id/profile/identification

  • Go to business dashboard on https://app.plasmapay.com/business

  • Create your first crypto checkout app

  • Then you can use server-to-server integration using provided API KEY. Go to API Reference Docs.

Order

ENDPOINTS:
GET 'https://app.plasmapay.com/business/crypto/api/v1/public/quote'
POST 'https://app.plasmapay.com/business/crypto/api/v1/public/orders/create'
GET 'https://app.plasmapay.com/business/crypto/api/v1/public/orders/{orderId}'

Invoices are statements of amounts owed by a customer, and are either generated one-off.

They contain invoice items, and proration adjustments that may be caused by subscription upgrades/downgrades (if necessary).

Note that finalizing the invoice, when automatic, does not happen immediately as the invoice is created. PlasmaPay would sent a webhook after success invoice payment. If you (and the platforms you may have connected to) have no webhooks configured, PlasmaPay provides an API that can be called to figure out invoice status.

PlasmaPay applies any customer credit on the account before determining the amount due for the invoice (i.e., the amount that will be actually charged). If the success message was receved you should send this `API_KEY` for all your request to the server. Using an request without `API_KEY` will return an error.

GET /quote

Get a quote.

Shell
JS
Shell
curl
-X GET
-H "content-type: application/json"
-H "authorization: Bearer <API_KEY>"
https://app.plasmapay.com/business/crypto/api/v1/public/quote?from={FROM}&to={TO}&amount={AMOUNT}
JS
var request = require('request');
const options = {
uri: 'https://app.plasmapay.com/business/crypto/api/v1/public/quote',
method: 'GET',
headers: {
'content-Type': 'application/json',
'authorization': 'Bearer API_KEY'
},
qs: {
"from": "{FROM}",
"to": "{TO}",
"amount": "{AMOUNT}"
}
}
request(options, function (error, response, body) {
if (!error && response.statusCode === 200) {
// Handle body
}
});

RESPONSE

200 Ok
Content-Type: application/json

BODY

{
"quoteId": "{QUOTE_ID}",
"fiat": {
"amount": "{AMOUNT}",
"currencyCode": "{FROM}",
"min": "{MIN_AMOUNT}",
"max": "{MAX_AMOUNT}"
},
"crypto": {
"amount": "{CRYPTO_AMOUNT}",
"currencyCode": "{TO}"
}
}

In order to get a quote from the server you must make a GET request to

GET https://app.plasmapay.com/business/crypto/api/v1/public/quote

with the apiKey as query parameter or Bearer <API_KEY> as authorization header.

Parameter

Meaning

Available values

from={FROM}

Currency code you want to sell (required)

EUR

to={TO}

Currency code you want to buy (required)

BTC

amount={AMOUNT}

Amount in a currency code FROM (required)

-

After receive the success response you can create an order by using https://app.plasmapay.com/business/crypto/api/v1/public/create api to create a new order.

POST /orders/create

Create an order by sending form via post

Shell
JS
Shell
curl
-X POST
-H "content-type: application/json"
-H "authorization: Bearer <API_KEY>"
https://app.plasmapay.com/business/crypto/api/v1/public/orders/create
-d '{"withdrawalAddress": "{WITHDRAWAL_ADDRESS}", "quoteId": "{QUOTE_ID}", "metadata": {"{KEY}": "{VALUE}"}, "merchantId": "{MERCHANT_ID}", "accountId": "{USER_ID}", "email": "{EMAIL}", "phone": "{PHONE}" }'
JS
var request = require('request');
const options = {
uri: 'https://app.plasmapay.com/business/crypto/api/v1/public/orders/create',
method: 'POST',
headers: {
'content-Type': 'application/json',
'authorization': 'Bearer API_KEY'
},
json: {
"withdrawalAddress": "{WITHDRAWAL_ADDRESS}",
"quoteId": "{QUOTE_ID}",
"metadata": {
"{KEY}": "{VALUE}"
},
"merchantId": "{MERCHANT_ID}",
"accountId": "{USER_ID}",
"email": "{EMAIL}",
"phone": "{PHONE}"
}
}
request(options, function (error, response, body) {
if (!error && response.statusCode === 200) {
// Handle body
}
});

RESPONSE

200 Ok
Content-Type: application/json

BODY

{
"id": "{ID}",
"status": "{STATUS}",
"method": "{METHOD}",
"fiatCurrencyCode": "{FIAT_CURRENCY_CODE}",
"fiatAmount": "{FIAT_AMOUNT}",
"cryptoCurrencyCode": "{CRYPTO_CURRENCY_CODE}",
"cryptoAmount": "{CRYPTO_AMOUNT}",
"quote": "{QUOTE}",
"withdrawalAddress": "{WITHDRAWAL_ADDRESS}",
"link": "{LINK}",
"createdAt": "{CREATED_AT}",
"updatedAt": "{UPDATED_AT}",
"metadata": {
"{KEY}": "{VALUE}"
},
"merchantId": "{MERCHANT_ID}",
"accountId": "{USER_ID}",
"email": "{EMAIL}",
"phone": "{PHONE}"
}

In order to create a new order on the server you must make a POST request to

POST https://app.plasmapay.com/business/crypto/api/v1/public/orders/create

with the apiKey as query parameter or Bearer <API_KEY> as authorization header.

After receive response you must redirect/open user browser with {LINK}.

Parameter

Meaning

withdrawalAddress={WITHDRAWAL_ADDRESS}

string (required) Withdrawal address you want to get crypto

quoteId={QUOTE_ID}

string (required) Quote ID you have got from /quote request

method={METHOD}

string (optional) Method of payment example "credit_card"

successUri={SUCCESS_URI}

string (optional) Success URI for return user to your success page

failureUri={FAILURE_URI}

string (optional) Failure URI for return user to your failure page

merchantId={MERCHANT_ID}

string (optional) External ID / ID of your order

accountId={USER_ID}

string (optional) External user ID / ID of your user

metadata={METADATA}

string (optional) Key value storage

email={EMAIL}

string (optional) Email of a user

phone={PHONE}

string (optional) The phone number to lookup in E.164 format, which consists of a + followed by the country code and subscriber number - 12 to 24 characters

GET /orders/{orderId}

Get an order.

Shell
JS
Shell
curl
-X GET
-H "content-type: application/json"
-H "authorization: Bearer <API_KEY>"
https://app.plasmapay.com/business/crypto/api/v1/public/orders/{orderId}
JS
var request = require('request');
const options = {
uri: 'https://app.plasmapay.com/business/crypto/api/v1/public/orders/{orderId}',
method: 'GET',
headers: {
'content-Type': 'application/json',
'authorization': 'Bearer API_KEY'
},
json: true
}
request(options, function (error, response, body) {
if (!error && response.statusCode === 200) {
// Handle body
}
});

RESPONSE

200 Ok
Content-Type: application/json

BODY

{
"id": "{ID}",
"status": "{STATUS}",
"method": "{METHOD}",
"fiatCurrencyCode": "{FIAT_CURRENCY_CODE}",
"fiatAmount": "{FIAT_AMOUNT}",
"cryptoCurrencyCode": "{CRYPTO_CURRENCY_CODE}",
"cryptoAmount": "{CRYPTO_AMOUNT}",
"quote": "{QUOTE}",
"withdrawalAddress": "{WITHDRAWAL_ADDRESS}",
"link": "{LINK}",
"createdAt": "{CREATED_AT}",
"updatedAt": "{UPDATED_AT}",
"metadata": {
"{KEY}": "{VALUE}"
},
"merchantId": "{MERCHANT_ID}",
"accountId": "{USER_ID}",
"email": "{EMAIL}",
"phone": "{PHONE}"
}

In order to get a quote from the server you must make a GET request to

GET https://app.plasmapay.com/business/crypto/api/v1/public/orders/{orderId}

with the apiKey as query parameter or Bearer <API_KEY> as authorization header.

Status codes

The PlasmaPay API uses the following error codes:

Code

Meaning

200

OK Successful request

201

Created New object saved

204

No content Object deleted

Code

Meaning

400

Bad Request -- You have passed a malformed request

401

Unauthorized -- Your API key is incorrect

403

Forbidden -- The resource requested is not available with your permissions

404

Not Found -- The specified resource could not be found

422

Unprocurable Entity -- Your request is invalid

500

Internal Server Error -- We had a problem with our server. Try again later

503

Service Unavailable (Time out) -- The server is overloaded or down for maintenance