Copy link
Using API for checkout
Postman collection with all endpoints - Using_API_for_checkout.postman_collection.zip
Use the CPAY API for checkout creating. When you create a charge, we generate payment addresses on your behalf for each cryptocurrency that’s enabled and provide you with a hosted page you can send to customers to complete the payment.
Login to merchant
You need to get api keys for your merchant and login to your merchant in order to get the token necessary for creating checkout and further actions on them.
Parameters
Body
- publicKey
*
string
- privateKey
*
string
Responses
- 200:OK{token: "String"}
- 200:OK
Example
{token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxOTIzNjAyNjM3OTE4MDFkMGQzODgzNiIsInVzZXIiOiI2MDlhNjM0MGU1ZTFjZjAyMTU2ZDBkZjciLCJpYXQiOjE2NjQyMjk2NzAsImV4cCI6MTY2NDMxNjA3MH0.9pMjfySEl-3AK6wSrH6I7_2wawnwMohyTKVTqd5ELew"} - 400:Bad request
If request body parameters are empty or have incorrect type (not string)
{status: "fail",data: {message: ["publicKey should not be empty","privateKey should not be empty"]}} - 401
If you use incorrect merchant token
{status: "fail",data: {message: "Unauthorized"}}
Checkout (donation) creating
Parameters
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- organizationName
*
string
- description
*
string
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
*
string
- metadata
object
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {_id: "String",collectEmail: "Boolean",collectName: "Boolean",currencies: ["String"],type: "String",expireTime: "Number",description: "String",organizationName: "String",merchant: "String",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},linkLogoImage: "string",createdAt: "2022-09-26T22:10:30.634Z",updatedAt: "2022-09-26T22:10:30.634Z",}}
- 200:OK
Example
{data: {_id: "6332235650a1280200bcacce",collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "Donation",expireTime: 10,description: "Test desc",organizationName: "Test name",merchant: "6192360263791801d0d38836",identifier: "181719e9-f233-4f9b-92bc-1334737eee76",image: "/uploads/family_chooser_tecnica_m8881.png",backgroundColor: "#000000",accentColor: "#ffffff",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},logoImage: "/uploads/logo.png",createdAt: "2022-09-26T22:10:30.634Z",updatedAt: "2022-09-26T22:10:30.634Z",}} - 400:Bad request
If request body parameters are empty or have incorrect type (not string)
{status: "fail",data: {message: ["organizationName should not be empty","description must be a string"]}} - 401
If you use incorrect merchant token
{status: "fail",data: {message: "Unauthorized"}}
Checkout (sale) creating
Parameters
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- productName
*
string
- description
*
string
- price
*
string
- fiatCurrency
*
string
must be only USD, AUD, BRL, EUR, GPB, NGN, TRY, UAH
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
*
string
- metadata
object
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {_id: "String",collectEmail: "Boolean",collectName: "Boolean",currencies: ["String",],type: "String",expireTime: "Number",description: "String",productName: "String",price: "Number",fiatCurrency: "String",merchant: "String",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",linkLogoImage: "string",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},createdAt: "2022-09-26T22:12:46.983Z",updatedAt: "2022-09-26T22:12:46.983Z",}}
- 200:OK
Example
{data: {_id: "633223de50a1280200bcaccf",collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "Sale",expireTime: 10,description: "Test desc",productName: "Test name",price: "100.5",fiatCurrency: "USD",merchant: "6192360263791801d0d38836",identifier: "4b2d9cd0-6c73-466e-a6f8-c9112cf8e91d",image: "/uploads/family_chooser_tecnica_m7331.png",backgroundColor: "#000000",accentColor: "#ffffff",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},linkLogoImage: "/uploads/logo.png",createdAt: "2022-09-26T22:12:46.983Z",updatedAt: "2022-09-26T22:12:46.983Z",}} - 400:Bad request{status: "fail",data: {message: ["description should not be empty","price must not be less than 1","price must be a number conforming to the specified constraints","fiatCurrency must be a valid enum value"]}}
- 401{status: "fail",data: {message: "Unauthorized"}}
Checkout (sale token) creating
Parameters
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- description
*
string
- productName
*
string
- price
*
string
Not required if fixed=false
- min
*
string
- max
*
string
- fiatCurrency
*
string
USD, AUD, BRL, EUR, GPB, NGN, TRY, UA, Not required if fixed=false
- fixed
*
Boolean
- tradedCurrency
*
string
- tradedWallet
*
string
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
boolean
- metadata
object
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {_id: "String",collectEmail: "Boolean",collectName: "Boolean",currencies: ["String",],type: "String",expireTime: "Number",description: "String",productName: "String",price: "Number",min: "Number",max: "Number",fiatCurrency: "String",fixed: "Boolean",tradedCurrency: "String",tradedWallet: "String",merchant: "String",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},linkLogoImage: "string",createdAt: "2022-09-27T08:11:32.705Z",updatedAt: "2022-09-27T08:11:32.705Z",}}
- 200:OK
Example
{data: {_id: "6332b03450a1280200bcad1e",collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "SaleToken",expireTime: 10,description: "Test desc",productName: "Test desc",price: "1",min: "100",max: "500",fiatCurrency: "USD",fixed: true,tradedCurrency: "61641091597bd03988be5c62",tradedWallet: "61b1b7b0dea80a01147f8a56",merchant: "6192360263791801d0d38836",identifier: "8d8981ae-dafe-4f33-8e29-71f218ebf41a",image: "/uploads/family_chooser_tecnica_m5822.png",backgroundColor: "#000000",accentColor: "#ffffff",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},linkLogoImage: "/uploads/logo.png",createdAt: "2022-09-27T08:11:32.705Z",updatedAt: "2022-09-27T08:11:32.705Z",}} - 401{status: "fail",data: {message: "Unauthorized"}}
Checkout (sale token estimate max) creating
Parameters
Path
- merchantId
*
string
Body
- tradedWallet
*
string
- tradedCurrency
*
string
- checkoutId
string
Responses
- 200:OK{data: {max: "string"}}
- 200:OK
Example
{data: {max: "0.06372"}} - 401{status: "fail",data: {message: "Unauthorized"}}
Checkout (cart) creating
Parameters
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- description
*
string
- fiatCurrency
*
string
USD, AUD, BRL, EUR, GPB, NGN, TRY, UA
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
boolean
- cartName
*
string
- metadata
object
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {cartName: "String",_id: "String",identifier: "String",merchant: "String",currencies: ["String","String","String","String","String","String",],image: "String",collectName: "Boolean",collectEmail: "Boolean",expireTime: 10,fiatCurrency: "String",description: "String",accentColor: "String",backgroundColor: "String",type: "String",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},createdAt: "String",updatedAt: "String",__v: "Number"}}
- 200:OK
Example
{status: "success",data: {cartName: "String",_id: "String",identifier: "String",merchant: "String",currencies: ["String","String","String","String","String","String",],image: "String",collectName: "Boolean",collectEmail: "Boolean",expireTime: 10,fiatCurrency: "String",description: "String",accentColor: "String",backgroundColor: "String",type: "String",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},createdAt: "String",updatedAt: "String",__v: "Number"}}} - 400{status: "fail",data: { }}
Get all checkouts list
Parameters
Query
- order
string
Available values: ASC, DESC. Defaule value: ASC
- page
number
Default value: 1
- limit
number
Default value: 10
- merchantId
string
Default value: 10
- search
string
Responses
- 200:OK{data: {entities: [{collectEmail: "Boolean",collectName: "Boolean",currencies: ["String",],type: "String",_id: "String",expireTime: "Number",description: "String",productName: "String",price: "Number",min: "Number",max: "Number",fiatCurrency: "String",fixed: "Boolean",tradedCurrency: "String",tradedWallet: "String",merchant: "String",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",logoImage: "string",createdAt: "2022-09-27T08:11:32.705Z",updatedAt: "2022-09-27T08:11:32.705Z",}],page: "Number",pages: "Number",countItem: "Number"}}
- 200:OK
Example
{data: {entities: [{collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "SaleToken",_id: "6332b03450a1280200bcad1e",expireTime: 10,description: "Test desc",productName: "Test desc",price: "1",min: "100",max: "500",fiatCurrency: "USD",fixed: true,tradedCurrency: "61641091597bd03988be5c62",tradedWallet: "61b1b7b0dea80a01147f8a56",merchant: "6192360263791801d0d38836",identifier: "8d8981ae-dafe-4f33-8e29-71f218ebf41a",image: "/uploads/family_chooser_tecnica_m5822.png",backgroundColor: "#000000",accentColor: "#ffffff",logoImage: "/uploads/logo.png",createdAt: "2022-09-27T08:11:32.705Z",updatedAt: "2022-09-27T08:11:32.705Z",}],page: 1,pages: 6,countItem: 6}} - 401{status: "fail",data: {message: "Unauthorized"}}
Get a specific checkout
Parameters
Path
- checkoutId
*
string
Responses
- 200:OK{data: {collectEmail: "Boolean",collectName: "Boolean",currencies: ["String",],type: "String",_id: "String",expireTime: "Number",description: "String",productName: "String",price: "Number",min: "Number",max: "Number",fiatCurrency: "String",fixed: "Boolean",tradedCurrency: "String",tradedWallet: "String",merchant: "Object",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",logoImage: "string",createdAt: "2022-09-26T22:19:57.017Z",updatedAt: "2022-09-26T22:19:57.017Z",}}
- 200:OK
Example
{data: {collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "SaleToken",_id: "6332258d50a1280200bcacd0",expireTime: 10,description: "Test desc",productName: "Test desc",price: "300",min: "0.01",max: "0.05",fiatCurrency: "USD",fixed: true,tradedCurrency: "60ebfe8ffe376807f22943ef",tradedWallet: "63321da650a1280200bcacca",merchant: {payerCommission: "merchant",middleWallet: false,typeNetwork: "testnet",feeWallets: [],mainWallets: [{currency: "60ebfe8ffe376807f22943ef",wallet: "6192360263791801d0d38839"},{currency: "61641091597bd03988be5c62",wallet: "61b1b7b0dea80a01147f8a56"},{currency: "5edf278ac9ca4d5a342bf8ad",wallet: "6192360263791801d0d38838"},{currency: "5edf2767c9ca4d5a342bf8ac",wallet: "61e1aa254965d9025c889283"},{currency: "62e7c3669c167b624bd84f37",wallet: "632b27c250a1280200bca7a0"}],deleted: false,status: true,currencies: ["60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","61e674643b5bb81d7b96acba","60fa7e50db89fd7b3b94b293","5edf27a3c9ca4d5a342bf8ae","5edf278ac9ca4d5a342bf8ad","5edf2767c9ca4d5a342bf8ac","62e7c3669c167b624bd84f37"],_id: "6192360263791801d0d38836",name: "TestMerchant3",fee: 0,user: "609a6340e5e1cf02156d0df7",salt: "$2b$10$2KOt.sW0C7MCi87ODBTlKe5jas.jspI4.leTet6ljr7rkzBCt3GZG",createdAt: "2021-11-15T10:27:14.418Z",updatedAt: "2022-09-26T21:40:18.930Z",__v: 30,systemFee: 0.25},identifier: "3caa7dd1-7fd8-423a-ba91-a50f5bb7c485",image: "/uploads/family_chooser_tecnica_m9773.png",backgroundColor: "#000000",accentColor: "#ffffff",logoImage: "/uploads/logo.png",createdAt: "2022-09-26T22:19:57.017Z",updatedAt: "2022-09-26T22:19:57.017Z",}} - 401{status: "fail",data: {message: "Unauthorized"}}
- 404{status: "fail",data: {message: "Checkout not found."}}
Checkout deleting
Parameters
Path
- checkoutId
*
string
Responses
- 200:OK{data: "Boolean"}
- 200:OK
Example
{data: "true"} - 401{status: "fail",data: {message: "Unauthorized"}}
- 404{status: "fail",data: {message: "Checkout not found."}}
Checkout (donation) editing
Parameters
Path
- checkoutId
*
string
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- organizationName
*
string
- description
*
string
- deleteImage
boolean
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
*
string
- metadata
object
- deleteLogoImage
boolean
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {collectEmail: "Boolean",collectName: "Boolean",currencies: ["String"],type: "String",_id: "String",expireTime: "Number",description: "String",organizationName: "String",merchant: "String",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},linkLogoImage: "string",createdAt: "2022-09-26T22:10:30.634Z",updatedAt: "2022-09-26T22:10:30.634Z",}}
- 200:OK
Example
{data: {collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "Donation",_id: "6332235650a1280200bcacce",expireTime: 10,description: "Test desc",organizationName: "Test name",merchant: "6192360263791801d0d38836",identifier: "181719e9-f233-4f9b-92bc-1334737eee76",image: "/uploads/family_chooser_tecnica_m8881.png",backgroundColor: "#000000",accentColor: "#ffffff",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},logoImage: "/uploads/logo.png",createdAt: "2022-09-26T22:10:30.634Z",updatedAt: "2022-09-26T22:10:30.634Z",}} - 400{status: "fail",data: {message: ["organizationName should not be empty","description must be a string"]}}
- 401{status: "fail",data: {message: "Unauthorized"}}
- 404{status: "fail",data: {message: "Checkout not found."}}
Checkout (sale) editing
Parameters
Path
- checkoutId
*
string
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- description
*
string
- productName
*
string
- price
*
string
- fiatCurrency
*
string
must be only USD, AUD, BRL, EUR, GPB, NGN, TRY, UAH
- deleteImage
boolean
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
*
string
- metadata
object
- deleteLogoImage
boolean
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {_id: "String",collectEmail: "Boolean",collectName: "Boolean",currencies: ["String",],type: "String",expireTime: "Number",description: "String",productName: "String",price: "Number",fiatCurrency: "String",merchant: "String",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},linkLogoImage: "string",createdAt: "2022-09-26T22:12:46.983Z",updatedAt: "2022-09-26T22:12:46.983Z",}}
- 200:OK
Example
{data: {_id: "633223de50a1280200bcaccf",collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "Sale",expireTime: 10,description: "Test desc",productName: "Test name",price: "100.5",fiatCurrency: "USD",merchant: "6192360263791801d0d38836",identifier: "4b2d9cd0-6c73-466e-a6f8-c9112cf8e91d",image: "/uploads/family_chooser_tecnica_m7331.png",backgroundColor: "#000000",accentColor: "#ffffff",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},logoImage: "/uploads/logo.png",createdAt: "2022-09-26T22:12:46.983Z",updatedAt: "2022-09-26T22:12:46.983Z",}} - 400{status: "fail",data: {message: ["description should not be empty","price must not be less than 1","price must be a number conforming to the specified constraints","fiatCurrency must be a valid enum value"]}}
- 401{status: "fail",data: {message: "Unauthorized"}}
- 404{status: "fail",data: {message: "Checkout not found."}}
Checkout (sale token) editing
Parameters
Path
- checkoutId
*
string
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- description
*
string
- productName
*
string
- price
*
string
Not required if fixed=false
- min
*
string
- max
*
string
- fiatCurrency
*
string
USD, AUD, BRL, BRL, EUR, GPB, NGN, TRY, UAH, Not required if fixed=false
- fixed
*
Boolean
- tradedCurrency
*
string
- tradedWallet
*
string
- deleteImage
boolean
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
*
string
- metadata
object
- deleteLogoImage
boolean
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {_id: "String",collectEmail: "Boolean",collectName: "Boolean",currencies: ["String",],type: "String",expireTime: "Number",description: "String",productName: "String",price: "Number",min: "Number",max: "Number",fiatCurrency: "String",fixed: "Boolean",tradedCurrency: "String",tradedWallet: "String",merchant: "String",identifier: "String",image: "String",backgroundColor: "string",accentColor: "string",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},linkLogoImage: "string",createdAt: "2022-09-27T08:11:32.705Z",updatedAt: "2022-09-27T08:11:32.705Z",}}
- 200:OK
Example
{data: {_id: "6332b03450a1280200bcad1e",collectEmail: true,collectName: true,currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],type: "SaleToken",expireTime: 10,description: "Test desc",productName: "Test desc",price: "1",min: "100",max: "500",fiatCurrency: "USD",fixed: true,tradedCurrency: "61641091597bd03988be5c62",tradedWallet: "61b1b7b0dea80a01147f8a56",merchant: "6192360263791801d0d38836",identifier: "8d8981ae-dafe-4f33-8e29-71f218ebf41a",image: "/uploads/family_chooser_tecnica_m5822.png",backgroundColor: "#000000",accentColor: "#ffffff",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},logoImage: "/uploads/logo.png",createdAt: "2022-09-27T08:11:32.705Z",updatedAt: "2022-09-27T08:11:32.705Z",}} - 400{status: "fail",data: {message: ["description should not be empty","price must not be less than 1","price must be a number conforming to the specified constraints","fiatCurrency must be a valid enum value"]}}
- 401{status: "fail",data: {message: "Unauthorized"}}
A checkout object is returned with a URL to a hosted page where a customer can complete their charge. The customer is able to send any amount for donation or fixed amount for sale.
Checkout (cart) editing
Parameters
Body
- expireTime
*
number
10, 30, 60
- linkImage
*
string
- currencies
*
array
- collectName
*
boolean
- collectEmail
*
boolean
- description
*
string
- fiatCurrency
*
string
USD, AUD, BRL, EUR, GPB, NGN, TRY, UA
- backgroundColor
*
string
- accentColor
*
string
- linkLogoImage
boolean
- cartName
*
string
- deleteImage
*
boolean
- deleteLogoImage
*
boolean
- metadata
object
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {_id: "String",wallets: ["String"],checkout: "String",expiredDate: "String",typeNetwork: "String",status: "Boolean",systemStatus: "String",createdAt: "String",updatedAt: "String",customerEmail: "String",customerName: "String",metadata: {name: "String",description: "String",attributes: [{trait_type: "String",value: "String"},{trait_type: "String",value: "String"},{trait_type: "String",value: "String"}],image: "String",animation_url: "String",background_color: "String",youtube_url: "String",external_url: "String"},}}
- 200:OK
Example
{status: "success",data: {cartName: "Test name",_id: "658b0555151e3fec1b25a00e",identifier: "4481b603-24c6-41ff-8bd4-3eedff513743",merchant: "626af9cf1988ea2f40c7cf1e",currencies: ["5edf2767c9ca4d5a342bf8ac","5edf278ac9ca4d5a342bf8ad","5edf27a3c9ca4d5a342bf8ae","60ebfe8ffe376807f22943ef","60eee72676d1ef1761cf916c","60fa7e50db89fd7b3b94b293","61010e313cd67801573f46ed","61641091597bd03988be5c62","61767935597bd03988be5d0c","62e7c3669c167b624bd84f37"],image: "/uploads/family_chooser_tecnica_m8359.png",collectName: true,collectEmail: true,expireTime: 10,fiatCurrency: "USD",description: "Test desc",accentColor: "#99d714",backgroundColor: "#a35252",type: "Cart",metadata: {name: "Arcadium",description: "",attributes: [{trait_type: "Rarity",value: "Common"},{trait_type: "Supply",value: "Unlimited"},{trait_type: "Color",value: "Hazelium"},],image: "ipfs://QmQuTgCt9n7n8SmgJafV3vSgx9NM3KoGMFSyaSjFw9ajvx",animation_url: "ipfs://QmXX2BZQnS7ZvUmBQR1GzasUq4zgxkYtW6WT2cGmA6iUAA",background_color: "",youtube_url: "",external_url: "https://test.io/"},createdAt: "2023-12-26T16:54:45.772Z",updatedAt: "2023-12-26T16:54:45.772Z",__v: 0}}} - 400{status: "fail",data: {}}
Get the list of charges
Parameters
Path
- checkoutId
*
string
Query
- search
string
- sort
string
- order
string
Responses
- 200:OK{data: {entities: [{_id: "65aa7f9948bc5dc8c74bdc4e",systemStatus: "New",createdAt: "2024-01-19T13:56:41.466Z",id: "65aa7f9948bc5dc8c74bdc4e"},],page: 1,pages: 2,countItem: 14},}
- 401{status: "fail",data: {message: "Unauthorized"}}
Receive a payment
After creating a charge, CPAY will continuously monitor each blockchain network for a payment. Since cryptocurrencies are push payments, we set an expiration time for the charge which is currently 1 hour after the creation date. If the customer does not make a payment within that time frame, we consider the charge to be expired.
After the user opens the widget, two requests are sent: the first to receive the chargeId, and the second to receive all the information on the charge.
Get the chargeId
Parameters
Path
- identifier
*
string
checkout identifier
Query
- clickId
string
- fiatCurrency
string
AUD, BRL, EUR, GBP, NGN, RUB, TRY, UAH, USD - Only for donations
- amount
string
Only for donations
- createWallet
boolean
Responses
- 200:OK{data: {id: "String"}}
- 200:OK
Example
{data: {id: "6332a68850a1280200bcad1d"}} - 404{status: "fail",data: {message: "Checkout not found."}}
Wallet creation inside charge
Parameters
Path
- chargeId
*
string
- currencyId
*
string
Responses
- 200:OK{data: {id: "6672150499ef5f75adc0ed3c",address: "0x39B8aD9F2217A37a6b3dA5b2604fBA3bF42771CB",balance: "0",balanceUSD: "0",passphrase: "5bba79d0-c4b0-45bf-bad4-b7f8afc879b9",nodeType: "eth"},}
- 401{status: "fail",data: {message: "Unauthorized"}}
Get the charge
Use query parameters if you want "to turn" a donation into a sale
Parameters
Path
- chargeId
*
string
Query
- currency
string
BTC,ETH,USDT,BNB,BUSD,TRX,DOT,KSM,USD,AUD,BRL,EUR,GPB,NGN,TRY,UAH
- amount
string
Responses
- 200:OK{data: {id: "String",typeNetwork: "String",expiredDate: "String",systemStatus: "String",customerName: "String",customerEmail: "String",checkout: {collectEmail: "Boolean",collectName: "Boolean",currencies: [{decimals: "Number",_id: "String",name: "String",title: "String",nodeType: "String",currencyType: "String",replenishMinimumValue: "Number"}],type: "String",expireTime: "Number",description: "String",organizationName: "String",identifier: "String",image: "String"},wallets: [{address: "String",currency: {id: "String",name: "String",title: "String",nodeType: "String",currencyType: "String",minReplenish: "Number"}},]}}
- 200:OK
Example
{data: {id: "6332a68850a1280200bcad1d",typeNetwork: "testnet",expiredDate: "2022-09-27T07:40:16.554Z",systemStatus: "New",customerName: "Test name",checkout: {collectEmail: true,collectName: true,currencies: [{decimals: 8,_id: "5edf2767c9ca4d5a342bf8ac",name: "BTC",title: "Bitcoin",nodeType: "btc",currencyType: "currency",replenishMinimumValue: 0}],type: "Donation",expireTime: 10,description: "Test desc",organizationName: "Test name",identifier: "181719e9-f233-4f9b-92bc-1334737eee76",image: "/uploads/family_chooser_tecnica_m5283.png"},wallets: [{address: "mxdcqG7i9rkTARWwagM7unzEpP7GJQadSj",currency: {id: "5edf2767c9ca4d5a342bf8ac",name: "BTC",title: "Bitcoin",nodeType: "btc",currencyType: "currency",minReplenish: 0}}]}} - 401{status: "fail",data: {message: "Unauthorized"}}
Also you can get information about checkout by identifier
Parameters
Path
- identifier
*
string
checkout identifier
Query
- recipient
string
Only for Sale Token
Responses
- 200:OK{data: {collectEmail: "Boolean",collectName: "Boolean",currencies: [{decimals: "Number",_id: "String",name: "String",title: "String",nodeType: "String",currencyType: "String",replenishMinimumValue: "Number"}],type: "String",expireTime: "Number",description: "String",organizationName: "String",identifier: "String",image: "String"}}
- 200:OK
Example
{data: {collectEmail: "true",collectName: "true",currencies: [{decimals: "9",_id: "5edf2767c9ca4d5a342bf8ac",name: "BTC",title: "Bitcoin",nodeType: "btc",currencyType: "currency",replenishMinimumValue: 0}],type: "Donation",expireTime: 10,description: "Test desc",organizationName: "Test name",identifier: "181719e9-f233-4f9b-92bc-1334737eee76",image: "/uploads/family_chooser_tecnica_m5283.png"}} - 404{status: "fail",data: {message: "Checkout not found."}}
The user opens a charge with an available list of currencies and expired time. After selecting the currency, a unique client wallet is generated. In this case, the status of the charge is accepted as New. When the user sends funds to the selected wallet, the charge status is accepted as Pending. After successful payment, the status of the charge is accepted as Done. If the user has not paid for the charge at the specified time, then the status of the charge is accepted as Expired. If any error or failure has occurred in the network, then the status of the transaction is accepted as Failed. After successful replenishment, the user needs to click on the "Back" button to generate new wallets or replenish the previous wallet, but in this case the transaction will not be displayed in the widget.
Sale token
Exchange estimation
After opening the payment widget, you need to estimate the exchange
Parameters
Path
- identifier
*
string
Query
- currencyFrom
*
string
- amount
*
string
- type
*
string
Available values: direct, reverse
Responses
- 200:OK{data: {estimationId: "String",estimatedAmount: "String",validUntil: "Number",fixedRate: "String",minAmount: "String",maxAmount: "String",currencyFromId: "String",currencyToId: "String",type: "String",amount: "String"}}
- 200:OK
Example
{data: {estimationId: "f0107228-773b-4db6-bc67-267d11233bd4",estimatedAmount: "0.072311808518331043",validUntil: 1664267844,fixedRate: "1382.9",minAmount: "100",maxAmount: "500",currencyFromId: "5edf278ac9ca4d5a342bf8ad",currencyToId: "61641091597bd03988be5c62",type: "reverse",amount: "100"}} - 400{status: "fail",data: {message: ["currencyFrom must be a mongodb id"]}}
Charge creation
After using estimationId, you need to create a charge
Parameters
Path
- identifier
*
string
Query
- recipient
*
string
- estimationId
*
string
- clickId
string
- linkSite
string
This can be a link to any web resource that you want the client can open to after payment
Responses
- 200:OK{data: {id: "String"}}
- 200:OK
Example
{data: {id: "6332b5e050a1280200bcad26"}} - 404{status: "fail",data: {message: "Checkout not found."}}
Get charge data
At the last stage, you need to get the charge data
Parameters
Path
- chargeId
*
string
Responses
- 200:OK{data: {id: "String",typeNetwork: "String",expiredDate: "String",systemStatus: "String",checkout: {collectEmail: "Boolean",collectName: "Boolean",currencies: [{decimals: "Number",_id: "String",name: "String",title: "String",nodeType: "String",currencyType: "String",replenishMinimumValue: "Number"}],type: "String",expireTime: "Number",description: "String",productName: "String",price: "String",min: "String",max: "String",fiatCurrency: "String",fixed: "Boolean",tradedCurrency: {decimals: "Number",_id: "String",name: "String",title: "String",nodeType: "String",currencyType: "String",replenishMinimumValue: "Number"},tradedWallet: "String",identifier: "String",image: "String",},wallets: [{address: "String",currency: {id: "String",name: "String",title: "String",nodeType: "String",currencyType: "String",minReplenish: "Number"}}],expectedAmountFrom: "String",expectedAmountTo: "String",currencyFromId: "String",currencyToId: "String",recipient: "String"}}
- 200:OK
Example
{data: {id: "6332b5e050a1280200bcad26",typeNetwork: "testnet",expiredDate: "2022-09-27T08:45:44.441Z",systemStatus: "New",checkout: {collectEmail: true,collectName: true,currencies: [{decimals: 8,_id: "5edf2767c9ca4d5a342bf8ac",name: "BTC",title: "Bitcoin",nodeType: "btc",currencyType: "currency",replenishMinimumValue: 0}],type: "SaleToken",expireTime: 10,description: "Test desc",productName: "Test desc",price: "1",min: "100",max: "500",fiatCurrency: "USD",fixed: true,tradedCurrency: {decimals: 6,_id: "61641091597bd03988be5c62",name: "TRX",title: "Tron",nodeType: "trx",currencyType: "currency",replenishMinimumValue: 10},tradedWallet: "61b1b7b0dea80a01147f8a56",identifier: "8d8981ae-dafe-4f33-8e29-71f218ebf41a",image: "/uploads/family_chooser_tecnica_m5822.png",},wallets: [{address: "0xa36672Dcade0C9b0294279f0f93Aa36810244944",currency: {id: "5edf278ac9ca4d5a342bf8ad",name: "ETH",title: "Ethereum",nodeType: "eth",currencyType: "currency",minReplenish: 0.0001}}],expectedAmountFrom: "0.072311808518331043",expectedAmountTo: "100",currencyFromId: "5edf278ac9ca4d5a342bf8ad",currencyToId: "61641091597bd03988be5c62",recipient: "TR27Yjv6mVFFpm7es6ofPeBFFWoyhzRKwn"}} - 500{status: "fail",data: {message: "Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"}}
Customer details
Send customer details
To transfer user data, you need to send customer details
Parameters
Path
- chargeId
*
string
Body
- customerName
*
string
- customerEmail
*
string
Responses
- 200:OK{data: {_id: "String",wallets: ["String"],checkout: "String",expiredDate: "String",typeNetwork: "String",status: "Boolean",systemStatus: "String",createdAt: "String",updatedAt: "String",customerEmail: "String",customerName: "String",}}
- 200:OK
Example
{data: {_id: "6332a68850a1280200bcad1d",wallets: ["6332a68550a1280200bcad13","6332a68650a1280200bcad14","6332a68650a1280200bcad15","6332a68650a1280200bcad16","6332a68750a1280200bcad17","6332a68750a1280200bcad18","6332a68750a1280200bcad19","6332a68750a1280200bcad1a","6332a68850a1280200bcad1b","6332a68850a1280200bcad1c"],checkout: "6332235650a1280200bcacce",expiredDate: "2022-09-27T07:40:16.554Z",typeNetwork: "testnet",status: false,systemStatus: "New",createdAt: "2022-09-27T07:30:16.556Z",updatedAt: "2022-09-27T07:33:12.674Z",customerName: "Test name",}} - 400{status: "fail",data: {message: ["customerEmail must be an email"]}}
The user opens a charge with an available list of currencies and expired time. After selecting the currency, a unique client wallet is generated. In this case, the status of the charge is accepted as New. When the user sends funds to the selected wallet, the charge status is accepted as Pending. After successful payment, the status of the charge is accepted as Done. If the user has not paid for the charge at the specified time, then the status of the charge is accepted as Expired. If any error or failure has occurred in the network, then the status of the transaction is accepted as Failed. After successful replenishment, the user needs to click on the "Back" button to generate new wallets or replenish the previous wallet, but in this case the transaction will not be displayed in the widget.
To checkout Cart, you need to pass the amount and fiatCurrency parameters in the POST /api/checkout-client/{identifier}/charge query endpoint.