Endpoints
Create checkout session
The create checkout session API endpoint allows you to create a new checkout session for a customer to complete a payment. It returns an unique session ID and order ID.
Endpoint
POST https://checkout-api.candypay.fun/api/v1/session
Headers
Authorization
: Private API key as a Bearer token
Request
All the following parameters must be passed in the request's payload/body.
network
- It is eithermainnet
or devnet, specifying the network to use for the transactionsuccess_url
- The URL to which the customer is redirected after the transaction is successfulcancel_url
- The URL to which the customer is redirected after the transaction is canceledtokens
(Optional) - An array of optional tokens via which the customer can payitems
- An array of items which would be displayed on the checkout page. Each element of theitems
array is an object which must contain thename
,price
,image
,quantity
andsize
of the product. Extensive type definition - Itemsdiscounts
(Optional) - An object containing details regarding the NFT via which the customer can get discounts. Extensive type definition - Discountsshipping_fees
(Optional) - It is the fees required for shipping the item to the customer. Must be of typenumber
config
- An object containing details regarding additional configuration. Extensive type definition - Config
Response Body
session_id
- An unique identifier for the checkout sessionorder_id
- An unique identifier which can be used to track transactions in the dashboard
Generate payment URL
The generate payment URL API endpoint allows you to generate a payment URL from an exisiting checkout session ID, which users can visit and complete the payment
Endpoint
GET https://checkout-api.candypay.fun/api/v1/session/payment_url
Headers
Authorization
: Public API key as a Bearer token
Request
All the following parameters must be passed as query parameters.
session_id
- The unique identifier of the checkout session
Fetch checkout session metadata
The fetch checkout session metadata API endpoint allows you to retrieve the metadata of an existing checkout session. You can use this information to track the status of a checkout session, such as the transaction details, payment status, and other relevant information.
Endpoint
GET https://checkout-api.candypay.fun/api/v1/session
Headers
Authorization
: Public API key as a Bearer token
Request
All the following parameters must be passed as query parameters.
session_id
- The unique identifier of the checkout session