# Creating a Checkout Session for 1 USDC
curl --request POST \
--url 'https://api.copperx.dev/api/v1/checkout/sessions' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
"successUrl": "https://copperx.io/success?cid={CHECKOUT_SESSION_ID}",
"lineItems": {
"data": [
{
"priceData": {
"currency": "usdc",
"unitAmount": "100000000",
"productData": {
"name": "Basic",
"description": "For early stage projects who are getting started"
}
}
}
]
}
}'
# Sample response of a Checkout Session object
{
"id": "6bce7b07-825f-454e-bea8-3a2bb04a570b",
"createdAt": "2023-02-22T12:46:11.453Z",
"updatedAt": "2023-02-22T12:46:11.553Z",
"mode": "payment",
"paymentMethodTypes": [
"wallet"
],
"paymentSetting": {
"allowedChains": [
{
"chainId": 80001
}
],
"paymentMethodTypes": null,
"preferredChainId": 80001
},
"expiresAt": "2023-02-22T13:46:11.441Z",
"customerCreation": "if_required",
"customerUpdate": null,
"submitType": "pay",
"afterCompletion": null,
"organizationId": "ea2f521c-0f27-48bf-91f7-87dd8de98034",
"amountTotal": "100000000",
"currency": "usdc",
"paymentLinkId": null,
"subscriptionId": null,
"customerId": null,
"clientReferenceId": null,
"successUrl": "https://copperx.io/success?cid=6bce7b07-825f-454e-bea8-3a2bb04a570b",
"cancelUrl": null,
"status": "open",
"paymentStatus": "unpaid",
"metadata": null,
"emailCollection": false,
"phoneNumberCollection": false,
"shippingAddressCollection": false,
"billingAddressCollection": false,
"afterCompletionConfirmMsg": null,
"shippingDetails": {},
"billingDetails": {},
"url": "https://buy.copperx.dev/payment/checkout-session/6bce7b07-825f-454e-bea8-3a2bb04a570b",
"customerDetails": {
"address": {}
},
"lineItems": {
"object": "list",
"data": [
{
"amountTotal": "100000000",
"currency": "usdc",
"description": null,
"quantity": 1,
"price": {
"id": "49da18aa-c09a-4d36-9171-23474685f5bd",
"createdAt": "2023-02-22T12:46:11.392Z",
"updatedAt": "2023-02-22T12:46:11.392Z",
"billingScheme": "per_unit",
"currency": "usdc",
"productId": "5a4b57b4-9bff-465e-bf4e-04e4d3659ca3",
"interval": null,
"usageType": null,
"type": "one_time",
"unitAmount": "100000000",
"unitAmountDecimal": null,
"customUnitMax": null,
"customUnitMin": null,
"customPreset": null,
"customUnitAmountSuggestions": null,
"product": {
"id": "5a4b57b4-9bff-465e-bf4e-04e4d3659ca3",
"createdAt": "2023-02-22T12:46:11.380Z",
"updatedAt": "2023-02-22T12:46:11.420Z",
"name": "Basic",
"description": "For early stage projects who are getting started",
"isActive": true,
"images": [],
"unitLabel": null,
"url": null,
"metadata": null,
"defaultPriceId": "49da18aa-c09a-4d36-9171-23474685f5bd",
"visibility": 10
},
"metadata": null,
"isActive": true,
"visibility": 20
}
}
]
},
"addresses": [
{
"id": "85f8fe19-3465-4201-b2a9-eefce83f1eeb",
"createdAt": "2023-02-22T12:46:11.553Z",
"updatedAt": "2023-02-22T12:46:11.553Z",
"checkoutSessionId": "6bce7b07-825f-454e-bea8-3a2bb04a570b",
"asset": {
"id": "a60c79d2-7f9f-4b03-a597-85e7432edb5f",
"name": "USDC",
"address": "0x953ecae2e3c8ee8723fef049de53666d7126dde9",
"chainId": 80001,
"currency": "usdc",
"symbol": "USDC",
"decimals": 6,
"coingeckoId": "usd-coin",
"isPublic": true,
"superToken": {
"address": "0x6d691bd589cc175714a85bbd528b96c011a24fe6",
"symbol": "CXUSDCx",
"decimals": 18
}
},
"paymentAddress": "0x81b63dc0daccee035b186e07356ac53fb1260af4"
}
],
"paymentIntent": {
"id": "481d6649-aa07-444a-8fcc-929968514e65",
"createdAt": "2023-02-22T12:46:11.442Z",
"updatedAt": "2023-02-22T12:46:11.442Z",
"organizationId": "ea2f521c-0f27-48bf-91f7-87dd8de98034",
"amount": "100000000",
"amountReceived": null,
"currency": "usdc",
"status": "requires_payment_method",
"paymentMethodId": null,
"paymentMethodTypes": [
"wallet"
],
"description": null,
"transferAccountAddress": null,
"transactions": []
}
}
If user cancels the payment, then user will be redirected to the URL provided in cancelUrl
.