Create a new payment

POST https://api.llamapay.io/charges

Headers

Name
Value

Authorization

llamapay_sk_YOUR_API_KEY

Body parameters

Key
Value
Example

pricing_type

Can be either: - fixed_price for simple one-time payments - no_price for payments where user picks amount, eg donations - subscription for recurring subscriptions

"fixed_price"

local_price

Amount to charge user. If pricing_type is subscription, this is the monthly cost

{ "amount": "10.00", "currency": "USD" }

metadata

[Optional] Arbitrary JSON object, it will be returned on webhooks for the payment. Object must be smaller than 20kB

{ "userId": "0xngmi" }

redirect_url

[Optional] URL to redirect user to after successful payment.

"https://mypage.com/success"

cancel_url

[Optional] URL to redirect user to if they cancel the payment

"https://mypage.com/failure"

Example body

Charge the user a one-time payment of 10$:

{
	"pricing_type": "fixed_price",
	"local_price": {
		"amount": "10.00",
		"currency": "USD"
	},
	"metadata": {
		"userId": "0xngmi"
	}
}

Response

{
  "data": {
    ...
    "hosted_url": "https://checkout.llamapay.io/pay/fd533947-6889-4970-8fb9-6441342dc07d",
    ...
  }
}

Last updated