(EVM only) Send Redeem Transaction with Credits Authorization Message
POST https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx Content-Type: application/json
Endpoint to send a credits redeem transaction on EVM-based blockchains.
This endpoint processes a gasless transaction for redeeming credits. It requires a signed permit message
(contained in signedMessages.permitCredits) that was previously generated by the /evm/creditsAuthMsg endpoint.
How It Works:
- Validates that the provided signed permit (EIP-712 signature) is correct.
- Constructs the transaction using provided details and sends it through the appropriate EVM network provider.
Request Body:
merchantId(string): The ID of the merchant.subtotal(Subtotal): The transaction subtotal.transactionData(EvmTransactionData): Details of the transaction to be executed.signedMessages(SignedMessages): Contains the signed permit message (permitCredits) for credit authorization.chargebackProtectionData?(CartItemClassOmitted): Optional chargeback protection data.validBefore,nonce,creditsRawAmount: Values returned by/evm/creditsAuthMsgfor further verification.
Response: Returns an object containing:
hash(string): The transaction hash of the submitted gasless transaction.
Reference: /api-reference/api-reference/redeem/send-evm-credits-gasless-tx
Authentication
x-coinflow-auth-walletheader (required) — The web3 wallet of the end user - see /api-reference/api-reference/authentication/get-session-keyx-coinflow-auth-blockchainheader (required) — The blockchain associated with the end user - see /api-reference/api-reference/authentication/get-session-key
Request
Headers
x-device-id(string, optional) — Optional device identifier provided in the request header.
Body (application/json)
merchantId(string, required) — The ID of the merchant requesting redemption.subtotal(object or object or object, required)- CurrencyCents
cents(integer, required)currency(enum, required)- Allowed values:
USD,AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,BYN,BZD,CAD,CHF,CLF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GMD,GNF,GTQ,GYD,HKD,HNL,HTG,HUF,IDR,ILS,INR,IQD,IRR,ISK,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,MMK,MNT,MOP,MRU,MUR,MWK,MVR,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RWF,SAR,SCR,SDG,SEK,SGD,SLE,SLL,SOS,SRD,STN,SVC,SYP,SZL,THB,TJS,TMT,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,UYU,UZS,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW,ZWL,CDF,ERN,FKP,KPW,RUB,SBD,SHP,SSP,VES
- Allowed values:
- Cents
cents(integer, required)
- TokenSubtotal
address(string, required) — The tokens address Solana - Token Mint Address Evm - Token Contract Addressamount(double or string, required) — Number of tokensdecimals(double, optional) — Number of decimals for the token
- CurrencyCents
transactionData(object or object or object or object or object or object, required) — (EVM only) if you want to execute an EVM transaction on a successful purchase, you can pass a transaction request here. Gas fees for the transaction will be automatically calculated and added to the total charged to the customer. Optionally the merchant can opt to pay for these gas fees.- SafeMintRedeem
transaction(object, required) — Transaction to be called.data(string, required) — The data to call this contract with, HEX encoded. The coinflow contract calls the “to” contract, contract pulls USDC from msg.sender, and transfers the NFT/item to the “receiver” address defined in the contract function arguments.to(string, required) — The merchant’s whitelisted contract
type(enum, required)- Allowed values:
safeMint
- Allowed values:
waitForHash(boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.nftContract(string, optional)
- ReturnedTokenIdRedeem
transaction(object, required) — Transaction to be called.data(string, required) — The data to call this contract with, HEX encoded. The coinflow contract calls the “to” contract, contract pulls USDC from msg.sender, and transfers the NFT/item to the “receiver” address defined in the contract function arguments.to(string, required) — The merchant’s whitelisted contract
type(enum, required)- Allowed values:
returned
- Allowed values:
waitForHash(boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.nftContract(string, optional)
- KnownTokenIdRedeem
transaction(object, required) — Transaction to be called.data(string, required) — The data to call this contract with, HEX encoded. The coinflow contract calls the “to” contract, contract pulls USDC from msg.sender, and transfers the NFT/item to the “receiver” address defined in the contract function arguments.to(string, required) — The merchant’s whitelisted contract
nftContract(string, required) — The address of the Nft’s ContractnftId(string, required) — The ID of the NFT being purchased. Will be forwarded by the Coinflow contract to the customer’s wallet.waitForHash(boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.
- NormalRedeem
transaction(object, required) — Transaction to be called.data(string, required) — The data to call this contract with, HEX encoded. The coinflow contract calls the “to” contract, contract pulls USDC from msg.sender, and transfers the NFT/item to the “receiver” address defined in the contract function arguments.to(string, required) — The merchant’s whitelisted contract
waitForHash(boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.
- TokenRedeem
type(enum, required)- Allowed values:
token
- Allowed values:
destination(string, required)waitForHash(boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.
- DecentRedeem
type(enum, required)- Allowed values:
decent
- Allowed values:
dstChainId(double, required) — ID of the destination chain you will be using Find your chain ID here: https://chainlist.org/dstToken(string, required) — Address on that chain of the token you will be receivingcontractAddress(string, required) — The contract address which will be called on the destination chaincontractData(string, required)cost(object, required) — Amount of the token on the destination chain you will be receivingisNative(boolean, required) — Whether or not the token is the native token for the chain (ex: Ethereum - ETH, Polygon - POL). If native dstToken should be the 0 address (0x00…)amount(string, required) — This is the raw amount of the token ex: 50000000000000n
waitForHash(boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.
- SafeMintRedeem
signedMessages(object, required)permitCredits(string, required) — (Evm only) This is the signed permit messages that the user must sign granting the Merchant Contract access to their balances.customerUsdcAuthData(object, optional) — Customer signed USDC transferWithAuthorization data for dual-source payments Used for combined USDC + Credit Card payments on EVM chainsfrom(string, required)to(string, required)value(string, required)validAfter(string or double, required)validBefore(string or double, required)nonce(string, required)v(double, required)r(string, required)s(string, required)
customerUsdcAuthDataV2(object, optional) — V2 of CustomerUsdcTransferData — replaces the (v, r, s) triple with a singlesignaturebytes string, matching USDC FiatTokenV2_2’s bytes-overloadtransferWithAuthorization. All other fields unchanged from V1.from(string, required)to(string, required)value(string, required)validAfter(string or double, required)validBefore(string or double, required)nonce(string, required)signature(string, required)
validBefore(string, required) — Values returned from getEvmCreditsAuthMsg endpointnonce(string, required)creditsRawAmount(double, required)usdcAmount(object, optional)cents(integer, required)
chargebackProtectionData(list of object, optional)productName(string, required) — The name of the related productproductType(enum, required)- Allowed values:
inGameProduct,gameOfSkill,dataStorage,computingResources,sportsTicket,eSportsTicket,musicTicket,conferenceTicket,virtualSportsTicket,virtualESportsTicket,virtualMusicTicket,virtualConferenceTicket,alcohol,DLC,subscription,fundACause,realEstate,computingContract,digitalArt,topUp,ownershipContract,inGameCurrency,digitalCollectibles,digitalCollectiblesMarketplace,digitalGiftingMarketplace,sweepstakes,virtualSportsEvents,contractInvoicing,onlineCasino,cryptoOnramp,gaming,travelDocuments,musicStreaming,digitalContent,eBooks,digitalSubscriptionContent
- Allowed values:
quantity(double, required) — The number of units soldlistPrice(object, optional) — The item’s list pricecurrency(string, optional)valueInCurrency(double, optional)
rawProductData(object, optional)example(string, optional)
seller(object, optional)id(string, optional) — Id of the selleremail(string, optional, nullable) — Email Example: lois.lane@dailyplanet.comfirstName(string, optional) — First name Example: LoislastName(string, optional) — Last name Example: Loisdob(string, optional) — Date of birth, formatted as YYYY-MM-DD. If only the year is known, use YYYY Pattern: ^\d(-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]))?$rawSellerData(object, optional) — Construct a type with a set of properties K of type T
transactionHistory(list of object, optional)txType(string, required)chain(string, required)paymentAmount(string, required)paymentToken(string, required)to(string, required)from(string, required)registryContract(string, required)assetID(string, required)txTime(string, required)blockNumber(double, required)txHash(string, required)
Response
200
Ok
hash(string, required)
Examples
Request
{
"merchantId": "merchant_9f8b7c6d5e4a3b2c1d0e",
"subtotal": {
"cents": 2599,
"currency": "USD"
},
"transactionData": {
"transaction": {
"data": "0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8",
"to": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4"
},
"type": "safeMint"
},
"signedMessages": {
"permitCredits": "0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b"
},
"validBefore": "2024-07-01T12:00:00Z",
"nonce": "0x1a2b3c4d5e6f7890",
"creditsRawAmount": 25.99
}
Response
{
"hash": "0x9f8b7c6d5e4a3b2c1d0e9f8b7c6d5e4a3b2c1d0e9f8b7c6d5e4a3b2c1d0e9f8b"
}
SDK Code
import requests
url = "https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx"
payload = {
"merchantId": "merchant_9f8b7c6d5e4a3b2c1d0e",
"subtotal": {
"cents": 2599,
"currency": "USD"
},
"transactionData": {
"transaction": {
"data": "0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8",
"to": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4"
},
"type": "safeMint"
},
"signedMessages": { "permitCredits": "0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b" },
"validBefore": "2024-07-01T12:00:00Z",
"nonce": "0x1a2b3c4d5e6f7890",
"creditsRawAmount": 25.99
}
headers = {
"x-coinflow-auth-wallet": "<apiKey>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = 'https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx';
const options = {
method: 'POST',
headers: {'x-coinflow-auth-wallet': '<apiKey>', 'Content-Type': 'application/json'},
body: '{"merchantId":"merchant_9f8b7c6d5e4a3b2c1d0e","subtotal":{"cents":2599,"currency":"USD"},"transactionData":{"transaction":{"data":"0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8","to":"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4"},"type":"safeMint"},"signedMessages":{"permitCredits":"0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b"},"validBefore":"2024-07-01T12:00:00Z","nonce":"0x1a2b3c4d5e6f7890","creditsRawAmount":25.99}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx"
payload := strings.NewReader("{\n \"merchantId\": \"merchant_9f8b7c6d5e4a3b2c1d0e\",\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"transactionData\": {\n \"transaction\": {\n \"data\": \"0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8\",\n \"to\": \"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4\"\n },\n \"type\": \"safeMint\"\n },\n \"signedMessages\": {\n \"permitCredits\": \"0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b\"\n },\n \"validBefore\": \"2024-07-01T12:00:00Z\",\n \"nonce\": \"0x1a2b3c4d5e6f7890\",\n \"creditsRawAmount\": 25.99\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-coinflow-auth-wallet", "<apiKey>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
require 'uri'
require 'net/http'
url = URI("https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-coinflow-auth-wallet"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchantId\": \"merchant_9f8b7c6d5e4a3b2c1d0e\",\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"transactionData\": {\n \"transaction\": {\n \"data\": \"0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8\",\n \"to\": \"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4\"\n },\n \"type\": \"safeMint\"\n },\n \"signedMessages\": {\n \"permitCredits\": \"0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b\"\n },\n \"validBefore\": \"2024-07-01T12:00:00Z\",\n \"nonce\": \"0x1a2b3c4d5e6f7890\",\n \"creditsRawAmount\": 25.99\n}"
response = http.request(request)
puts response.read_body
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.post("https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx")
.header("x-coinflow-auth-wallet", "<apiKey>")
.header("Content-Type", "application/json")
.body("{\n \"merchantId\": \"merchant_9f8b7c6d5e4a3b2c1d0e\",\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"transactionData\": {\n \"transaction\": {\n \"data\": \"0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8\",\n \"to\": \"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4\"\n },\n \"type\": \"safeMint\"\n },\n \"signedMessages\": {\n \"permitCredits\": \"0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b\"\n },\n \"validBefore\": \"2024-07-01T12:00:00Z\",\n \"nonce\": \"0x1a2b3c4d5e6f7890\",\n \"creditsRawAmount\": 25.99\n}")
.asString();
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx', [
'body' => '{
"merchantId": "merchant_9f8b7c6d5e4a3b2c1d0e",
"subtotal": {
"cents": 2599,
"currency": "USD"
},
"transactionData": {
"transaction": {
"data": "0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8",
"to": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4"
},
"type": "safeMint"
},
"signedMessages": {
"permitCredits": "0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b"
},
"validBefore": "2024-07-01T12:00:00Z",
"nonce": "0x1a2b3c4d5e6f7890",
"creditsRawAmount": 25.99
}',
'headers' => [
'Content-Type' => 'application/json',
'x-coinflow-auth-wallet' => '<apiKey>',
],
]);
echo $response->getBody();
using RestSharp;
var client = new RestClient("https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx");
var request = new RestRequest(Method.POST);
request.AddHeader("x-coinflow-auth-wallet", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"merchantId\": \"merchant_9f8b7c6d5e4a3b2c1d0e\",\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"transactionData\": {\n \"transaction\": {\n \"data\": \"0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8\",\n \"to\": \"0x5B38Da6a701c568545dCfcB03FcB875f56beddC4\"\n },\n \"type\": \"safeMint\"\n },\n \"signedMessages\": {\n \"permitCredits\": \"0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b\"\n },\n \"validBefore\": \"2024-07-01T12:00:00Z\",\n \"nonce\": \"0x1a2b3c4d5e6f7890\",\n \"creditsRawAmount\": 25.99\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation
let headers = [
"x-coinflow-auth-wallet": "<apiKey>",
"Content-Type": "application/json"
]
let parameters = [
"merchantId": "merchant_9f8b7c6d5e4a3b2c1d0e",
"subtotal": [
"cents": 2599,
"currency": "USD"
],
"transactionData": [
"transaction": [
"data": "0xa9059cbb000000000000000000000000b794f5ea0ba39494ce839613fffba7427957926800000000000000000000000000000000000000000000000000000000000003e8",
"to": "0x5B38Da6a701c568545dCfcB03FcB875f56beddC4"
],
"type": "safeMint"
],
"signedMessages": ["permitCredits": "0x2c6401ff1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b"],
"validBefore": "2024-07-01T12:00:00Z",
"nonce": "0x1a2b3c4d5e6f7890",
"creditsRawAmount": 25.99
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.coinflow.cash/api/redeem/evm/sendGaslessTx")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()