Accept Crypto Payments

This guide outlines the process for incorporating crypto payments into your workflow with Layer1 via API, allowing you to customise your own payments page as desired.

The guide covers the integration of payment links into your platform to accept crypto payments, detailing the following steps:

  1. Initiating a payment request and handling the response.
  2. Guiding the end user to complete the payment.
  3. Setting up a webhook listener for payment notifications.
  4. Managing payment exceptions and errors.

Payment flow

The payment proceeds through the following stages:

  1. An end user makes a deposit request in your system, where you need to collect the following information:
    • Amount for the deposit
    • Cryptocurrency they want to pay with
    • Protocol, if applicable
  2. This information is then forwarded to BVNK as a Create Payment request.
  3. The Create Payment endpoint returns an API response containing a crypto address matching the selected blockchain, along with other useful data. You can share this address with the end user, along with the total amount of cryptocurrency required to complete the payment.
  4. The end user makes a payment to this address, which will then cause multiple related webhooks to be sent to your webhook listener as the payment goes through its lifecycle.
  5. Once you receive the final COMPLETE webhook, you can poll the Get Payment endpoint to confirm the status and final paid amount or take the information from the webhook.
  6. Update the end user's account accordingly with the confirmed payment amount.
The sequence diagram for a crypto payment in followed in this guide.

The sequence diagram for a crypto pay-in

Payment lifecycle

A payment undergoes several status changes throughout its lifecycle:

StatusImmutable?Description
pendingNoThe initial status of your payment. Indicates that the payment remains in this state until it expires or a transaction linked to it is detected on the blockchain
processingNoIndicates that the customer's payment has been detected on the blockchain. The payment remains in this state until funds are credited to your wallet.
Note: Payments can still expire in this state if the transaction lacks sufficient gas or if the blockchain does not confirm the transaction within the expiry time
completeYesIndicates that the funds have been received and credited to the merchant account in the chosen currency
underpaidYesIndicates that the funds have been received and credited to the merchant account in the chosen currency, but the amount sent by the customer was less than the requested amount
expiredYesIndicates that the payment expired before the customer sent the funds