API Reference

Authentication

All calls must be authenticated with the header Authorization: llamapay_sk_YOUR_API_KEY. You can obtain the required API Key in the Developer tab on LlamaPay's interface.

Create a new payment

post

Creates a new payment that users can then pay

Authorizations
Body
pricing_typestring · enumOptionalPossible values:
local_priceobjectOptionalExample: {"amount":"10.00","currency":"USD"}
metadataobjectOptionalExample: {"userId":"0xngmi"}
redirect_urlstringOptionalExample: https://mypage.com/success
cancel_urlstringOptionalExample: https://mypage.com/failure
Responses
200
Successfully created a payment
application/json
post
POST /charges HTTP/1.1
Host: api.llamapay.io
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 197

{
  "pricing_type": "fixed_price",
  "local_price": {
    "amount": "10.00",
    "currency": "USD"
  },
  "metadata": {
    "userId": "0xngmi"
  },
  "redirect_url": "https://mypage.com/success",
  "cancel_url": "https://mypage.com/failure"
}
{
  "data": {
    "id": "3e66112f-e4ad-4d5d-acb2-332e18fe4e4f",
    "hosted_url": "https://checkout.llamapay.io/pay/3e66112f-e4ad-4d5d-acb2-332e18fe4e4f",
    "created_at": "2024-07-01T04:57:41.034Z",
    "metadata": {
      "userId": "0xngmi"
    },
    "pricing_type": "fixed_price"
  }
}

Fetch a paginated list of payments

get

Pagination is handled by querying the urls returned in pagination.previous_uri and pagination.next_uri or by using the query parameters ending_before and starting_after directly with payment ids. In other words, to see all results keep querying pagination.next_uri until its null.

Authorizations
Query parameters
starting_afterstringOptional

Optional and for pagination, filters results to those whose id parameters are higher than the id sent

ending_beforestringOptional

Optional and for pagination, filters results to those whose id parameters are lower than the id sent

Responses
200
Array of payments
application/json
get
GET /charges HTTP/1.1
Host: api.llamapay.io
Authorization: YOUR_API_KEY
Accept: */*
200

Array of payments

{
  "pagination": {
    "previous_uri": "https://api.llamapay.io/charges?ending_before=fd533947-6889-4970-8fb9-6441342dc07d",
    "next_uri": "https://api.llamapay.io/charges?starting_after=082ac3c4-8c93-4c59-8e43-e4531640e264"
  },
  "data": [
    {
      "id": "3e66112f-e4ad-4d5d-acb2-332e18fe4e4f",
      "hosted_url": "https://checkout.llamapay.io/pay/3e66112f-e4ad-4d5d-acb2-332e18fe4e4f",
      "created_at": "2024-07-01T04:57:41.034Z",
      "metadata": {
        "userId": "0xngmi"
      },
      "pricing_type": "fixed_price"
    }
  ]
}

Fetch a single payment

get
Authorizations
Path parameters
payment_idstringRequired

id parameter obtained from /charges or webhook events

Responses
200
Payment info
application/json
get
GET /charges/{payment_id} HTTP/1.1
Host: api.llamapay.io
Authorization: YOUR_API_KEY
Accept: */*
{
  "data": {
    "id": "3e66112f-e4ad-4d5d-acb2-332e18fe4e4f",
    "hosted_url": "https://checkout.llamapay.io/pay/3e66112f-e4ad-4d5d-acb2-332e18fe4e4f",
    "created_at": "2024-07-01T04:57:41.034Z",
    "metadata": {
      "userId": "0xngmi"
    },
    "pricing_type": "fixed_price"
  }
}

Last updated