/v2/payment_intentsAuth requiredCreate a payment intent
Creates a payment intent: a fiat amount you want to collect from a customer. The intent is not tied to any cryptocurrency yet. Once the customer picks one, you create a payment quote against the intent.
The intent belongs to one of your stores. If you have more than one store, pass match_callback to choose it. Payment notifications for the intent go to that store's callback URL.
Requires Bearer token authentication. Include Authorization: Bearer YOUR_API_KEY in the request header.
Request Body
amountintegerrequiredAmount to collect, in the smallest unit of currency (for example cents). 1000 = 10.00 USD.
currencystringrequiredFiat currency code
match_callbackstringPart of the callback URL of the store to create the intent in. Matches any store whose callback URL contains this string. Required when you have more than one store.
extra_datastringYour own reference for the intent, such as an order ID. Returned on the intent, never shown to the payer.
Responses
amountbody · integerrequiredAmount to collect, in the smallest unit of `currency` (for example cents). `1000` = 10.00 USD.
currencybody · stringrequiredFiat currency code
match_callbackbody · stringPart of the callback URL of the store to create the intent in. Matches any store whose callback URL contains this string. Required when you have more than one store.
extra_databody · stringYour own reference for the intent, such as an order ID. Returned on the intent, never shown to the payer.
Response will appear here
Request
curl -X POST \
"https://www.blockonomics.co/api/v2/payment_intents" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"currency": "USD",
"match_callback": "www.example.com",
"extra_data": "order-1042"
}'const response = await fetch('https://www.blockonomics.co/api/v2/payment_intents', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"amount": 1000,
"currency": "USD",
"match_callback": "www.example.com",
"extra_data": "order-1042"
})
})
const data = await response.json()
console.log(data)import requests
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.post(
"https://www.blockonomics.co/api/v2/payment_intents",
headers=headers,
json={
"amount": 1000,
"currency": "USD",
"match_callback": "www.example.com",
"extra_data": "order-1042"
}
)
print(response.json())Response
{
"data": {
"id": "d5e88bd4-2964-4554-9a81-ab64c391d174",
"store_id": 1243,
"amount": 1000,
"currency": "USD",
"status": "unpaid",
"paid_amount": 0,
"extra_data": "order-1042"
}
}