Intents
Create intent
Creates a new Payment Intent. The same idempotencyKey within 24 hours returns the existing Intent with X-Idempotent-Replayed: true.
POST
/
intents
Create a payment intent
curl --request POST \
--url https://api.crycketpay.com/v1/intents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chain": "solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp",
"token": "USDC",
"amount": "10.50",
"requestor": "<string>",
"idempotencyKey": "order_982734",
"fulfiller": "<string>",
"direction": "request",
"ttlSeconds": 86400,
"metadata": {
"orderId": "982734"
}
}
'import requests
url = "https://api.crycketpay.com/v1/intents"
payload = {
"chain": "solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp",
"token": "USDC",
"amount": "10.50",
"requestor": "<string>",
"idempotencyKey": "order_982734",
"fulfiller": "<string>",
"direction": "request",
"ttlSeconds": 86400,
"metadata": { "orderId": "982734" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chain: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp',
token: 'USDC',
amount: '10.50',
requestor: '<string>',
idempotencyKey: 'order_982734',
fulfiller: '<string>',
direction: 'request',
ttlSeconds: 86400,
metadata: {orderId: '982734'}
})
};
fetch('https://api.crycketpay.com/v1/intents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crycketpay.com/v1/intents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain' => 'solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp',
'token' => 'USDC',
'amount' => '10.50',
'requestor' => '<string>',
'idempotencyKey' => 'order_982734',
'fulfiller' => '<string>',
'direction' => 'request',
'ttlSeconds' => 86400,
'metadata' => [
'orderId' => '982734'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crycketpay.com/v1/intents"
payload := strings.NewReader("{\n \"chain\": \"solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp\",\n \"token\": \"USDC\",\n \"amount\": \"10.50\",\n \"requestor\": \"<string>\",\n \"idempotencyKey\": \"order_982734\",\n \"fulfiller\": \"<string>\",\n \"direction\": \"request\",\n \"ttlSeconds\": 86400,\n \"metadata\": {\n \"orderId\": \"982734\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crycketpay.com/v1/intents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chain\": \"solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp\",\n \"token\": \"USDC\",\n \"amount\": \"10.50\",\n \"requestor\": \"<string>\",\n \"idempotencyKey\": \"order_982734\",\n \"fulfiller\": \"<string>\",\n \"direction\": \"request\",\n \"ttlSeconds\": 86400,\n \"metadata\": {\n \"orderId\": \"982734\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crycketpay.com/v1/intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain\": \"solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp\",\n \"token\": \"USDC\",\n \"amount\": \"10.50\",\n \"requestor\": \"<string>\",\n \"idempotencyKey\": \"order_982734\",\n \"fulfiller\": \"<string>\",\n \"direction\": \"request\",\n \"ttlSeconds\": 86400,\n \"metadata\": {\n \"orderId\": \"982734\"\n }\n}"
response = http.request(request)
puts response.read_body{
"intent": {
"id": "pi_abc123def456ghij",
"chain": "solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp",
"token": "USDC",
"amount": "10.50",
"requestor": "<string>",
"direction": "request",
"state": "created",
"reference": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"livemode": true,
"idempotencyKey": "<string>",
"tokenAddress": "<string>",
"amountBaseUnits": "<string>",
"fulfiller": "<string>",
"retryRequired": true,
"pendingAtExpiry": true,
"txSignature": "<string>",
"detectedAt": "2023-11-07T05:31:56Z",
"ataRentLamports": 123,
"ttlSeconds": 86400,
"confirmedAt": "2023-11-07T05:31:56Z",
"finalizedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"refundedBy": "<string>",
"refundOf": "<string>"
}
}{
"error": {
"code": "intent.already_fulfilled",
"message": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "intent.already_fulfilled",
"message": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "intent.already_fulfilled",
"message": "<string>",
"param": "<string>",
"details": {}
}
}Authorizations
API key. Use pk_live_* for production or pk_test_* for test mode.
Body
application/json
CAIP-2 chain identifier
Example:
"solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp"
Canonical symbol or chain-specific address
Example:
"USDC"
Decimal string amount
Example:
"10.50"
Wallet address of the requestor
Caller-supplied idempotency key, unique per account per 24h
Example:
"order_982734"
Optional wallet address of the fulfiller
Available options:
request, send Time-to-live in seconds (min 300, max 2592000)
Custom key-value pairs, max 20 keys
Show child attributes
Show child attributes
Example:
{ "orderId": "982734" }
Response
Payment Intent created
Show child attributes
Show child attributes
⌘I
Create a payment intent
curl --request POST \
--url https://api.crycketpay.com/v1/intents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chain": "solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp",
"token": "USDC",
"amount": "10.50",
"requestor": "<string>",
"idempotencyKey": "order_982734",
"fulfiller": "<string>",
"direction": "request",
"ttlSeconds": 86400,
"metadata": {
"orderId": "982734"
}
}
'import requests
url = "https://api.crycketpay.com/v1/intents"
payload = {
"chain": "solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp",
"token": "USDC",
"amount": "10.50",
"requestor": "<string>",
"idempotencyKey": "order_982734",
"fulfiller": "<string>",
"direction": "request",
"ttlSeconds": 86400,
"metadata": { "orderId": "982734" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chain: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp',
token: 'USDC',
amount: '10.50',
requestor: '<string>',
idempotencyKey: 'order_982734',
fulfiller: '<string>',
direction: 'request',
ttlSeconds: 86400,
metadata: {orderId: '982734'}
})
};
fetch('https://api.crycketpay.com/v1/intents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crycketpay.com/v1/intents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain' => 'solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp',
'token' => 'USDC',
'amount' => '10.50',
'requestor' => '<string>',
'idempotencyKey' => 'order_982734',
'fulfiller' => '<string>',
'direction' => 'request',
'ttlSeconds' => 86400,
'metadata' => [
'orderId' => '982734'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crycketpay.com/v1/intents"
payload := strings.NewReader("{\n \"chain\": \"solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp\",\n \"token\": \"USDC\",\n \"amount\": \"10.50\",\n \"requestor\": \"<string>\",\n \"idempotencyKey\": \"order_982734\",\n \"fulfiller\": \"<string>\",\n \"direction\": \"request\",\n \"ttlSeconds\": 86400,\n \"metadata\": {\n \"orderId\": \"982734\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crycketpay.com/v1/intents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chain\": \"solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp\",\n \"token\": \"USDC\",\n \"amount\": \"10.50\",\n \"requestor\": \"<string>\",\n \"idempotencyKey\": \"order_982734\",\n \"fulfiller\": \"<string>\",\n \"direction\": \"request\",\n \"ttlSeconds\": 86400,\n \"metadata\": {\n \"orderId\": \"982734\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crycketpay.com/v1/intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain\": \"solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp\",\n \"token\": \"USDC\",\n \"amount\": \"10.50\",\n \"requestor\": \"<string>\",\n \"idempotencyKey\": \"order_982734\",\n \"fulfiller\": \"<string>\",\n \"direction\": \"request\",\n \"ttlSeconds\": 86400,\n \"metadata\": {\n \"orderId\": \"982734\"\n }\n}"
response = http.request(request)
puts response.read_body{
"intent": {
"id": "pi_abc123def456ghij",
"chain": "solana:5eykt4UsFv8P8NJdTREpY1vzqKq2Kvdp",
"token": "USDC",
"amount": "10.50",
"requestor": "<string>",
"direction": "request",
"state": "created",
"reference": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"livemode": true,
"idempotencyKey": "<string>",
"tokenAddress": "<string>",
"amountBaseUnits": "<string>",
"fulfiller": "<string>",
"retryRequired": true,
"pendingAtExpiry": true,
"txSignature": "<string>",
"detectedAt": "2023-11-07T05:31:56Z",
"ataRentLamports": 123,
"ttlSeconds": 86400,
"confirmedAt": "2023-11-07T05:31:56Z",
"finalizedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"refundedBy": "<string>",
"refundOf": "<string>"
}
}{
"error": {
"code": "intent.already_fulfilled",
"message": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "intent.already_fulfilled",
"message": "<string>",
"param": "<string>",
"details": {}
}
}{
"error": {
"code": "intent.already_fulfilled",
"message": "<string>",
"param": "<string>",
"details": {}
}
}