Pay Invoice

Make a payment on an invoice

As We learned in the earlier section about invoices, there are advantages to pre-determine request amounts. From a infrastructure perspective, it is advantageous to create invoice alike schemas even if no invoice was given to exactly determine what script to use to make certain payments.

The /pay endpoint takes up lookup response formats and triggers a payment. While that might sound a bit complex, we can imagine is as a standardization machine that can take up a variety of formats without worrying about their compatibility. Similar to the get invoice methods, there are also two ways to pay for an invoice. This includes an internal method and and external method.

Whereas the payment endpoint is essential to complete invoice requests, we created utility wrappers around the pay endpoint, such as the /send endpoint that lets you define address, type and amount to make transactions in a simpler format.

Pay Invoice using by URI response (external)

To make a invoice payment, take the response of the URI endpoint (the data) without any additional changes to pay a payment invoice.

DPP using /pay

This is an example of paying for a DPP invoice using the /pay endpoint. Please check in Get Invoice to get extended values for the body input using DPP.

Pay an Invoice

POST https://api.relysia.com/v1/pay

The endpoint enables users to pay their invoices that were earlier resolved and put into a standardized format by the /URI endpoint.

Request Body

NameTypeDescription

network*

String

uri*

String

memo*

String

type*

String

paymentUrl*

String

mainProtocol*

String

modes*

Object

beneficiary *

Object

version*

String

BIP270 using /pay

This is an example if paying for a BIP270 invoice using the /pay endpoint. Please check in Get Invoice to get extended values for the body input using BIP270.

Pay an Invoice

POST https://api.relysia.com/v1/pay

The endpoint enables users to pay their invoices that were earlier resolved and put into a standardized format by the /URI endpoint.

Request Body

NameTypeDescription

uri

String

type

String

mainProtocol

String

outputs

Array

inputs

Array

memo

String

isBSV

String

peer

String

peerData

String

peerProtocol

String

{
  "statusCode": 200,
  "data": {
    "status": "success",
    "msg": "Transaction sent successfully",
    "txid": "80e5b09f1613a0f82c94216e84db747b80b631be8618eb97f3ea4ab440ea223f"
  }
}

Pay Invoice using payment-request Invoice (internal)

This method involves constructing a transaction using the /rawTx API and using it as a parameter in another API to associate it with an internal invoice ID for payment confirmation.

Whether DPP or BIP270 is used, the process remains consistent. The /rawTx API is used to create the transaction, and its data is passed as a parameter in the relevant API to link it with an internal invoice ID.

Regardless of the invoice standard (DPP or BIP270) being utilized, the transaction construction and referencing process remains the same, ensuring compatibility and consistency across both methods.

Settle an invoice request

POST https://api.relysia.com/v1/paymentRequest/pay/:invoiceId

The API takes invoice and settles it.

Headers

NameTypeDescription

invoiceId*

String

Invoice ID to be paid

Request Body

NameTypeDescription

merchantData

String

merchant information

transaction*

String

Transaction hexadecimal value

refundTo

String

Address for refund if required

memo

Description about the transaction

{
  "statusCode": 200,
  "data": {
    "status": "success",
    "msg": "Operation completed successfully.",
    "statusCode": 200,
    "data": {
      "status": "success",
      "msg": "Payment Completed Successfully",
      "txId": "ef8bdedd64477adcf1d297cf7fbb92c743251634841418e43f6e74db921770a3"
    }
  }
}

Last updated