
- Amazon
- Shopify
- Flights
- Browser Automation
Integration Steps
Setup
Crossmint Project
Server-side API Key
Search for Products
B00O79SKV6.Create Crossmint Order
const baseUrl = 'staging'; // or 'www' for prod environment
const crossmintOrder = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
recipient: {
email: "[email protected]",
physicalAddress: {
name: "John Doe",
line1: "ABC Street",
city: "New York",
state: "NY",
postalCode: "10007",
country: "US"
}
},
locale: "en-US",
payment: {
receiptEmail: "[email protected]",
method: "base-sepolia",
currency: "usdc",
// Agent's wallet that pays for the transaction
payerAddress: "0x..."
},
lineItems: [{ productLocator: "amazon:B00O79SKV6" }]
})
});
const { order: paymentOrder } = await crossmintOrder.json();
Sign and Submit Payment
const baseUrl = 'staging'; // or 'www' for prod environment
const transaction = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/wallets/${userWallet}/transactions`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: {
calls: [{
transaction: paymentOrder.payment.preparation.serializedTransaction
}],
chain: "base-sepolia"
}
})
});
Alternative: Using External Wallets
Alternative: Using External Wallets
import { ethers } from "ethers";
async function processPayment(order, privateKey, rpcUrl) {
const isInsufficientFunds = order.payment.status === "crypto-payer-insufficient-funds";
if (isInsufficientFunds) {
throw new Error("Insufficient funds");
}
const serializedTransaction =
order.payment.preparation != null && "serializedTransaction" in order.payment.preparation
? order.payment.preparation.serializedTransaction
: undefined;
if (!serializedTransaction) {
throw new Error(
`No serialized transaction found for order, this item may not be available for purchase:\n\n ${JSON.stringify(
order,
null,
2,
)}`,
);
}
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
const wallet = new ethers.Wallet(privateKey, provider);
try {
const parsedTx = ethers.utils.parseTransaction(serializedTransaction);
// Rebuild the transaction object without gasLimit
const txRequest = {
to: parsedTx.to,
value: parsedTx.value,
data: parsedTx.data,
nonce: parsedTx.nonce,
chainId: parsedTx.chainId,
type: parsedTx.type ?? 2,
maxFeePerGas: parsedTx.maxFeePerGas,
maxPriorityFeePerGas: parsedTx.maxPriorityFeePerGas,
accessList: parsedTx.accessList || [],
};
// Estimate gas
const estimatedGasLimit = await provider.estimateGas({
...txRequest,
from: wallet.address, // ensure correct estimation context
});
// Attach estimated gas
const finalTx = {
...txRequest,
gasLimit: estimatedGasLimit,
};
const tx = await wallet.sendTransaction(finalTx);
console.log("Transaction sent! Hash:", tx.hash);
const receipt = await tx.wait();
console.log("Transaction confirmed in block:", receipt.blockNumber);
return receipt;
} catch (error) {
console.error("Error sending transaction:", error);
throw error;
}
}
// Usage example
const baseUrl = 'staging'; // or 'www' for prod environment
const rpcUrl = "https://base-sepolia.g.alchemy.com/v2/YOUR_API_KEY"; // or 'mainnet' for prod
const walletPrivateKey = "YOUR_PRIVATE_KEY";
// Call the function with your order, private key, and RPC URL
processPayment(paymentOrder, walletPrivateKey, rpcUrl);
Monitor Order Status
const baseUrl = 'staging'; // or 'www' for prod environment
const checkStatus = async (orderId) => {
const response = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders/${orderId}`, {
headers: {
'X-API-KEY': `${API_KEY}`
}
});
const { order } = await response.json();
switch(order.phase) {
case 'completed':
console.log('Amazon order confirmed!');
break;
case 'pending':
console.log('Processing order...');
break;
case 'failed':
console.log('Order failed:', order.delivery.status);
break;
}
return order;
};
const pollStatus = setInterval(async () => {
const order = await checkStatus(paymentOrder.orderId);
if (order.phase === 'completed' || order.phase === 'failed') {
clearInterval(pollStatus);
}
}, 30000);
Receive Order Confirmation
Integration Steps
Setup
Crossmint Project
Server-side API Key
Search for Products
Identify Product Variants
const baseUrl = 'staging'; // or 'www' for prod environment
const response = await fetch(`https://${baseUrl}.crossmint.com/api/unstable/ws/search`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
uid: {
productUrl: "https://elwoodclothing.com/collections/sweatshirts/products/oversized-core-crewneck-vintage-grey"
}
})
});
const { listings } = await response.json();
variants array from which the variantId can be extracted.Create Crossmint Order
const baseUrl = 'staging'; // or 'www' for prod environment
const crossmintOrder = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
recipient: {
email: "[email protected]",
physicalAddress: {
name: "John Doe",
line1: "ABC Street",
city: "New York",
state: "NY",
postalCode: "10007",
country: "US"
}
},
locale: "en-US",
payment: {
receiptEmail: "[email protected]",
method: "base-sepolia",
currency: "usdc",
payerAddress: "0x..."
},
lineItems: [{ productLocator: "shopify:https://elwoodclothing.com/collections/sweatshirts/products/oversized-core-crewneck-vintage-grey:<variantId>" }]
})
});
const { order: paymentOrder } = await crossmintOrder.json();
Sign and Submit Payment
const baseUrl = 'staging'; // or 'www' for prod environment
const transaction = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/wallets/${userWallet}/transactions`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: {
calls: [{
transaction: paymentOrder.payment.preparation.serializedTransaction
}],
chain: "base-sepolia"
}
})
});
Monitor Order Status
const baseUrl = 'staging'; // or 'www' for prod environment
const checkStatus = async (orderId) => {
const response = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders/${orderId}`, {
headers: {
'X-API-KEY': `${API_KEY}`
}
});
const { order } = await response.json();
switch(order.phase) {
case 'completed':
console.log('Shopify order confirmed!');
break;
case 'pending':
console.log('Processing order...');
break;
case 'failed':
console.log('Order failed:', order.delivery.status);
break;
}
return order;
};
const pollStatus = setInterval(async () => {
const order = await checkStatus(paymentOrder.orderId);
if (order.phase === 'completed' || order.phase === 'failed') {
clearInterval(pollStatus);
}
}, 30000);
Receive Order Confirmation
Integration Steps
Setup
Crossmint Project
Server-side API Key
Search for Flights
Check Flight Availability
const baseUrl = 'staging'; // or 'www' for prod environment
const response = await fetch(`https://${baseUrl}.crossmint.com/api/unstable/ws/search`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
uid: {
originIATA: "JFK",
destinationIATA: "ATH",
cabinClass: "economy",
passenger_number: 1,
departureFlightDetails: {
departureDate: "2025-07-19",
flightIds: ["AY4161"]
}
}
})
});
const { listings } = await response.json();
Create Worldstore Order
const baseUrl = 'staging'; // or 'www' for prod environment
const wsOrder = await fetch(`https://${baseUrl}.crossmint.com/api/unstable/ws/orders`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
sellerId: "1",
items: [{
listingId: "ws_flights-off_0000AvtB1fGEU1sZUjSIJm",
listingParameters: {
passengers: [{
title: "mr",
given_name: "John",
family_name: "Doe",
born_on: "1980-01-01",
gender: "m",
email: "[email protected]",
phone_number: "+14155552671",
identity_documents: [{
type: "passport",
unique_identifier: "123456789",
issuing_country_code: "US",
expires_on: "2030-04-24"
}]
}]
}
}],
orderParameters: {}
})
});
const { order } = await wsOrder.json();
Create Crossmint Order
const baseUrl = 'staging'; // or 'www' for test environment
const crossmintOrder = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
recipient: {
email: "[email protected]"
},
locale: "en-US",
payment: {
receiptEmail: "[email protected]",
method: "base-sepolia",
currency: "usdc",
payerAddress: "0x..."
},
// Pass the previous step's entire response object here
externalOrder: order
})
});
const { order: paymentOrder } = await crossmintOrder.json();
Sign and Submit Payment
const baseUrl = 'staging'; // or 'www' for test environment
const transaction = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/wallets/${userWallet}/transactions`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
params: {
calls: [{
transaction: paymentOrder.payment.preparation.serializedTransaction
}],
chain: "base-sepolia"
}
})
});
Alternative: Using External Wallets
Alternative: Using External Wallets
import { ethers } from "ethers";
async function processPayment(order, privateKey, rpcUrl) {
const isInsufficientFunds = order.payment.status === "crypto-payer-insufficient-funds";
if (isInsufficientFunds) {
throw new Error("Insufficient funds");
}
const serializedTransaction =
order.payment.preparation != null && "serializedTransaction" in order.payment.preparation
? order.payment.preparation.serializedTransaction
: undefined;
if (!serializedTransaction) {
throw new Error(
`No serialized transaction found for order, this item may not be available for purchase:\n\n ${JSON.stringify(
order,
null,
2,
)}`,
);
}
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
const wallet = new ethers.Wallet(privateKey, provider);
try {
const parsedTx = ethers.utils.parseTransaction(serializedTransaction);
// Rebuild the transaction object without gasLimit
const txRequest = {
to: parsedTx.to,
value: parsedTx.value,
data: parsedTx.data,
nonce: parsedTx.nonce,
chainId: parsedTx.chainId,
type: parsedTx.type ?? 2,
maxFeePerGas: parsedTx.maxFeePerGas,
maxPriorityFeePerGas: parsedTx.maxPriorityFeePerGas,
accessList: parsedTx.accessList || [],
};
// Estimate gas
const estimatedGasLimit = await provider.estimateGas({
...txRequest,
from: wallet.address, // ensure correct estimation context
});
// Attach estimated gas
const finalTx = {
...txRequest,
gasLimit: estimatedGasLimit,
};
const tx = await wallet.sendTransaction(finalTx);
console.log("Transaction sent! Hash:", tx.hash);
const receipt = await tx.wait();
console.log("Transaction confirmed in block:", receipt.blockNumber);
return receipt;
} catch (error) {
console.error("Error sending transaction:", error);
throw error;
}
}
// Usage example
const baseUrl = 'staging'; // or 'www' for prod environment
const rpcUrl = "https://base-sepolia.g.alchemy.com/v2/YOUR_API_KEY"; // or 'mainnet' for prod
const walletPrivateKey = "YOUR_PRIVATE_KEY";
// Call the function with your order, private key, and RPC URL
processPayment(paymentOrder, walletPrivateKey, rpcUrl);
Monitor Order Status
const baseUrl = 'staging'; // or 'www' for prod environment
const checkStatus = async (orderId) => {
const response = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders/${orderId}`, {
headers: {
'X-API-KEY': `${API_KEY}`
}
});
const { order } = await response.json();
switch(order.phase) {
case 'completed':
console.log('Flight booking confirmed!');
break;
case 'pending':
console.log('Processing booking...');
break;
case 'failed':
console.log('Booking failed:', order.delivery.status);
break;
}
return order;
};
const pollStatus = setInterval(async () => {
const order = await checkStatus(paymentOrder.orderId);
if (order.phase === 'completed' || order.phase === 'failed') {
clearInterval(pollStatus);
}
}, 30000);
Receive Booking Confirmation
Integration Steps
Setup
Crossmint Project
Server-side API Key
Select Website
- 300+ websites supported for testing (including SHEIN, Walmart, eBay and more)
- Contact us for the complete list of supported websites in staging
Create Crossmint Order
url:<product-url>:<variant description>.Variant Description Examples:- Size:
:size-medium,:size-9,:size-large - Color:
:color-black,:color-red - Combined:
:size-medium-color-black
const baseUrl = 'staging'; // or 'www' for prod environment
const crossmintOrder = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders`, {
method: 'POST',
headers: {
'X-API-KEY': `${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
recipient: {
email: "[email protected]",
physicalAddress: {
name: "John Doe",
line1: "ABC Street",
city: "New York",
state: "NY",
postalCode: "10007",
country: "US"
}
},
locale: "en-US",
payment: {
receiptEmail: "[email protected]",
method: "card-token",
},
lineItems: [{ productLocator: "url:https://www.nike.com/t/downshifter-13-mens-road-running-shoes-extra-wide-4M0LNf:size-9" }]
})
});
const { order: paymentOrder } = await crossmintOrder.json();
Complete Payment with Card Token
POST https://staging.crossmint.com/api/unstable/orders/{{orderId}}/payment
{
"token": "9f243106-d4a4-4327-a7cb-e3ec22031ed2" // credit card token
}
Monitor Order Status
const baseUrl = 'staging'; // or 'www' for prod environment
const checkStatus = async (orderId) => {
const response = await fetch(`https://${baseUrl}.crossmint.com/api/2022-06-09/orders/${orderId}`, {
headers: {
'X-API-KEY': `${API_KEY}`
}
});
const { order } = await response.json();
switch(order.phase) {
case 'completed':
console.log('Browser automation order confirmed!');
break;
case 'pending':
console.log('Processing order...');
break;
case 'failed':
console.log('Order failed:', order.delivery.status);
break;
}
return order;
};
const pollStatus = setInterval(async () => {
const order = await checkStatus(paymentOrder.orderId);
if (order.phase === 'completed' || order.phase === 'failed') {
clearInterval(pollStatus);
}
}, 30000);
Receive Order Confirmation

