Create Order
Last updated
Last updated
When the customer clicks the 'Pay with Crypto' button, he/she is going to the Crypto payment page payment_url. Create Order API does two things.
Create Order API will do two things.
You need to provide basic payment info to display, including price_amount, title, description. e.g. 9.9 USD for the monthly membership.
You will have a payment_url page to direct the user. The page will contain the basic payment info.
You need to provide the success_url (when the payment succeeds, the user will be redirected there), and callback_url (we will tell the callback_url when the payments succeed).
This is the ONLY API needed for your website.
POST https://api.mugglepay.com/v1/orders
Param | Type | Required | Description |
---|---|---|---|
We support major stable tokens and networks, here are the popular tokens. If the pay_currency as set, the invoice page will be checkout with the selected token. Here are the commonly used tokens.
The easiest way to try this API: Replace API_TOKEN_GET_FROM_ADMIN_PORTAL with the one from backend portal.
MugglePay Server will always return status 400. If API failed, it will return error_code and error as its object.
When the buyers create the order, they are redirected to payment_url, where they can see the payment amount and then pay with crypto.
Your received payments will be settled immediately if USD or stable currency is selected.
pay_currency | Token | Network |
---|---|---|
merchant_order_id
string
Merchant's custom order ID. We recommend using the orderID from your application. It's a unique order ID for your reference.
price_amount
double
Yes
The price set by the merchant. Example: 9.99
price_currency
string
Yes
The currency in which you wish to price your merchandise; used to define price parameter. Example: USD, CNY. Default USD
pay_currency
string
Only use this field if you have the payment gateway enabled, and it will select the payment gateway. e.g. ETH, USDT, USDC
title
string
Max 200 characters. Example: product title (Apple iPhone X), order id (OnlineStore Order #4321), cart id (Cart #00003552).
description
string
More details about this order. Max 800 characters. It can be cart items, product details or other information. Example: 1 x Apple iPhone X, 1 x Apple MacBook Air.
callback_url
string
Send an automated message to Merchant URL when order status is changed. For example, when the user finishes the payment, we will make a request with your token to callback_url. Example: http://onlinestore.com/payments/callback
cancel_url
string
Redirect to Merchant URL when the customer cancels the order. Example: http://onlinestore.com/cart
success_url
string
Redirect to Merchant URL after successful payment. Example: http://onlinestore.com/account/orders.
mobile
bool
Based on PC or Mobile Wap, we provide different links.
fast
bool
Return the payment url directly.
token
string
Your custom token to validate Payment Callback. If it's provided, we will add it to the request of Payment Callback. This token is generated by the merchants, which is different from API_TOKEN_GET_FROM_ADMIN_PORTAL (generated by MugglePay) in the headers.
USDT_ARB
USDT
Arbitrum
USDC_ARB
USDC
Arbitrum
ETH_ARB
ETH
Arbitrum
TON
TON
Ton Network
USDT_TON
USDT
Ton Network
USDT_BNB
USDT
BNB Chain
USDT_CELO
USDT
Celo
CUSD
CUSD
Celo
USDC_BASE
USDC
Base
ETH_BASE
ETH
Base