/api/v1/payment_intents/[slug]

Fetch the payment intent by identifier

GET - Public

The endpoint will require a role query parameter when fetching payment intent data!

Roles

The get request must specify the Role of the access token creator that is trying to fetch the payment intent details.

Roles can be represented with the following type

type Role = "customer" | "merchant";

The URL must contain the role query parameter with the specified role!

https://debitllama.com/api/v1/payment_intents/[slug]?role=[ROLE]

This endpoint will return a payment intent by it's on-chain identifier, simply referred to as payment_intent. This value is a poseidon hash computed as a nullifier to use on-chain when verifying zkSnarks. It's also used to identify the payment intent on-chain and in the Debitllama Api. The API will return the Payment Intent and the DynamicPaymentRequest associated with it where applicable.

interface DynamicPaymentRequest_ApiV1 {
  created_at: string;
  status: DynamicPaymentRequestJobsStatus_ApiV1;
  amount: string; // This is formatted ether in the DB, maybe I should serve it as WEI always!
  currency: Currency_ApiV1;
  chain_id: string;
  allocated_gas: string; // This is also formatted ether!
}

enum DynamicPaymentRequestJobsStatus_ApiV1 {
  CREATED = "Created",
  LOCKED = "Locked",
  COMPLETED = "Completed",
  REJECETED = "Rejected",
}
  • Created payment status means the Dynamic Payment request was submitted and will be ready for processing Locked status means the processing has started and the relayer will complete the intent

  • Completed status means the last payment has been completed and new one was not created,yet.

  • Rejected status means the payment can't be fulfilled. This can be because the relayer balance is too low or for other reasons.

If the account holder's balance is too low, the dynamic payment request can be created, but when it's locked for processing the payment will revert and reject the request.

POST - Authenticated Endpoint

You can request a dynamic payment by payment intent or cancel an existing one. The request must contain a valid access token to authenticate the user and the creator of the request must be the payee of the payment intent.

Request body for requesting a new payment:

{
"requested_debit_amount" : string
}

The requested debit amount must be a Formatted Eth string with decimals. Submitting WEI will most likely throw an error. Submitting it multiple times will override the previous request

To cancel a payment request you need to send a different JSON. The backend will automatically check if cancel_request is true, to determine which action you wish to take.

{
"cancel_request" : true,
"request_id" : number
}

Expect a response containing these parameters

result: { message: "CREATEDREQUEST" | "CANCELLEDREQUEST", id: number }

The result message depends on the triggered action, depending if it was a cancel_request , while the id is the request_id that was created/updated/deleted

Last updated