How to integrate Payonix to your website

5min

This tutorial will teach you how to integrate Payonix to your website and start accepting crypto payments.

Set up

  1. Go to https://app.payonix.io/signup and create an account if you haven’t already
  2. Go to https://app.payonix.io/merchant/create to create a new payment form (or go to the merchant page and click on “Create new payment form”

Get your API key and Form ID

API Key

To use our API you will need your API key. To get the one associated with your account, go to the settings page in the dashboard. At the top, you’ll see your API key. You can press the button at the right of the API key to copy it to your clipboard.

Form ID

Next, you need the ID of the form you want to create payments for. Go to the merchant section of the dashboard and select the form you want to use.

At the top, below the name of your form, you’ll see “Copy API ID”. You can click on it to copy the ID of the form to your clipboard.

Save both API key and Form ID to a secured place in your code that is not public so no one can make requests for you.

However, even if someone has your API key, the only thing they can do is create payments. That’s the only thing you can do with the API for now.

If you see suspicious activity with your API key, contact the support and we will give you a new one.

Create a payment

Now, in your back-end you need to use the API to create a payment and get a URL to redirect your users to.

In the front-end, when your users choose that they want to pay with crypto and then press a button to pay, you should call your back-end to create a payment.

In your back-end, you need to call the Merchant API with these parameters:

Creates a payment for a payment form and returns a URL
POST
Request
Header Parameters
api-key
required
String
The API key of your account to authenticate yourself
Body Parameters
formId
required
String
the ID of the form you want to create a payment for (the one you copied above)
costInUSD
required
String
the amount in USD that you want to charge (will be converted to an amount in the token that the user selects in the payment page)
successURL
required
String
the URL to redirect your users to after a successful payment
cancelURL
required
String
the URL to redirect your users to after a failed payment or a canceled payment
productNames
required
Array
The name(s) of the product(s) your user is buying (an array of strings with at list 1 element)
callbackEndpoint
optional
String
an endpoint that our system will send an API call to after a successful payment (you can use that to do something after the payment like create an order, register the user or anything else). All the payment data will be sent to that endpoint.
extraDataForCallback
optional
String
a JSON as a string that will be parsed and passed as it is to the callbackEndpoint along with the payment data.
customerEmail
optional
String
the email address of the customer (you might want to use that if you don’t collect any email in the form to be able to identify a customer and its the payments)
logoURL
optional
String
a URL to an image that will be used to display your logo in the payment page
productsImagesURLs
optional
Array
an array of URLs to images that will be displayed to show the user images of the product that are being purchased


That’s it! 🎉

You can now get paid in crypto on your website.



⚠️ Don't ever re-use a URL that we send you!

It can lead to failed payments and odd things in some cases.

To avoid that, use the URLs that we send you only once.