logo
POST https://api.peanut.me/charges

Request Body Parameters

Parameter
Type
Required
Description
pricing_type
string
Yes
Type of pricing. Options: "fixed_price", "no_price"
local_price
object
Yes
Price information containing amount and currency
local_price.amount
string
Yes
The price amount as a string
local_price.currency
string
No
The currency code (currently only "USD" is supported)
baseUrl
string
No
Custom base URL for the payment page
requestId
string
No
Existing request ID to associate with this charge
requestProps
object
No
Payment request properties
metadata
object
No
Arbitrary additional data. Returned in webhook call
redirect_url
string
No
URL to redirect user after successful payment
cancel_url
string
No
URL to redirect user if payment is canceled

Example Request

javascript
const res = await fetch('https://api.peanut.me/charges', { method: 'POST', headers: { "Content-Type": "application/json", 'api-key': "YOUR_API_KEY" }, body: JSON.stringify({ pricing_type: "fixed_price", local_price: { amount: "13.37", currency: "USD" }, redirect_url: "https://shopify.com/success", cancel_url: "https://shopify.com/cancel" }) }); const data = await res.json();

Example Response

Status Code: 201 Created
json
{ "data": { "id": "4f77223g-f5be-5e6d-bcb3-443f29gf5f5g", "hosted_url": "https://peanut.me/pay/4f77223g-f5be-5e6d-bcb3-443f29gf5f5g", "created_at": "2024-11-28T06:45:23.034Z", "metadata": { "userId": "0x742d35" }, "pricing_type": "fixed_price", "brand_color": "#122332", "brand_logo_url": "", "charge_kind": "WEB3", "code": "4f77223g-f5be-5e6d-bcb3-443f29gf5f5g", "collected_email": false, "organization_name": "", "payments": [], "pricing": { "local": { "amount": "13.37", "currency": "USD" }, "settlement": { "amount": "13.37", "currency": "USD" } }, "pwcb_only": false, "redirects": { "cancel_url": "", "success_url": "", "will_redirect_after_success": false }, "timeline": [], "web3_retail_payments_enabled": true }, "warnings": [] }

Error Responses

Status Code
Description
400
Bad Request - Invalid input parameters
500
Internal Server Error
Share