> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.coinflow.cash/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.coinflow.cash/_mcp/server.

# (EVM only) Get Credits Authorization Message

POST https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg
Content-Type: application/json

Endpoint to generate an EIP-712 typed data message for authorizing credits usage on EVM chains.

This endpoint is used to retrieve a "CreditsAuthorization" message that the user must sign using their wallet (e.g., MetaMask)
via the eth_signTypedData_v4 method. The resulting signed message (permitCredits) is then supplied to the
`/api/redeem/evm/sendGaslessTx` endpoint to execute a gasless redeem transaction.

**Request Body:**
- `merchantId` (string): The ID of the merchant requesting redemption.
- `subtotal` (Subtotal): The transaction subtotal (either in USDC or a token-based subtotal).
- `transactionData` (EvmTransactionData): Transaction details used for calculating gas fees and total credits required.

**Response:**
Returns an object with the following properties:
- `message` (string): A JSON string representing the EIP-712 typed data.
- `validBefore` (string): A timestamp or block number indicating until when the message is valid.
- `nonce` (string): A unique value to prevent replay attacks.
- `creditsRawAmount` (number): The raw credits amount calculated based on the transaction subtotal and estimated gas fees.

Reference: https://docs.coinflow.cash/api-reference/api-reference/redeem/get-evm-credits-auth-msg

## Authentication

- `x-coinflow-auth-wallet` header (required) — The web3 wallet of the end user - see https://docs.coinflow.cash/api-reference/api-reference/authentication/get-session-key
- `x-coinflow-auth-blockchain` header (required) — The blockchain associated with the end user - see https://docs.coinflow.cash/api-reference/api-reference/authentication/get-session-key
- `x-coinflow-auth-session-key` header (required) — The session key generated for the end user - see https://docs.coinflow.cash/api-reference/api-reference/authentication/get-session-key

## Request

### Body (application/json)

This endpoint expects a GetEvmCreditsAuthMsgBody.

- `merchantId` (string, required) — The ID of the merchant requesting redemption.
- `subtotal` (Subtotal, required)
- `transactionData` (EvmTransactionData, 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.
- `usdcAmount` (Cents, optional)

## Response

### 200

Ok

- `message` (string, required) — EIP-712 typed-data JSON string for the user to sign via eth_signTypedData_v
- `validBefore` (string, required) — Timestamp indicating signature validity period
- `nonce` (string, required) — Unique identifier for the transaction
- `creditsRawAmount` (double, required) — Total amount of credits that will be used including gas fees

## Errors

### 412 Precondition Failed Error

Wallet does not have enough credits to complete redeem request, this can happen when the network is slow. Please retry the request.

- `name` (string, required)
- `message` (string, required)
- `stack` (string, optional)

## Types

### Subtotal

- CurrencyCents: CurrencyCents
- Cents: Cents
- TokenSubtotal: TokenSubtotal

### EvmTransactionData

(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: SafeMintRedeem
- ReturnedTokenIdRedeem: ReturnedTokenIdRedeem
- KnownTokenIdRedeem: KnownTokenIdRedeem
- NormalRedeem: NormalRedeem
- TokenRedeem: TokenRedeem
- DecentRedeem: DecentRedeem

### Cents

- `cents` (integer, 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`

### TokenSubtotal

- `address` (string, required) — The tokens address Solana - Token Mint Address Evm - Token Contract Address
- `amount` (TokenSubtotalAmount, required) — Number of tokens, from 0 to 1,000,000,000,000 inclusive. String values must be a plain decimal with at most 12 integer digits and 18 fractional digits.
- `decimals` (double, optional) — Number of decimals for the token

### SafeMintRedeem

(EVM only) If your contract mints an NFT via a OpenZeppelin Safe Mint Call, then utilize this object. The contract mints the NFT to msg.sender (which is the Coinflow contract), the Coinflow contract picks up the SafeMint event, and fwd's the NFT to the end user's wallet.

- `transaction` (SafeMintRedeemTransaction, required) — Transaction to be called.
- `type` (enum, required)
  - Allowed values: `safeMint`
- `waitForHash` (boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.
- `nftContract` (string, optional)

### ReturnedTokenIdRedeem

(EVM only) If your contract returns the NFT ID, then utilize this object. The contract mints the NFT to msg.sender (which is the Coinflow contract), the Coinflow contract picks up the returned NFT ID, and fwd's the NFT to the end user's wallet.

- `transaction` (ReturnedTokenIdRedeemTransaction, required) — Transaction to be called.
- `type` (enum, required)
  - Allowed values: `returned`
- `waitForHash` (boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.
- `nftContract` (string, optional)

### KnownTokenIdRedeem

(EVM only) If your know the ID of the NFT being purchased, then utilize this object. The contract transfers the NFT to msg.sender (which is the Coinflow contract), the Coinflow contract fwd's the NFT to the end user's wallet.

- `transaction` (KnownTokenIdRedeemTransaction, required) — Transaction to be called.
- `nftContract` (string, required) — The address of the Nft's Contract
- `nftId` (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

(EVM only) If your contract sends the item/service being purchased via a custom "receiver" field, then utilize this object. The coinflow contract calls the "to" contract, which transfers the NFT/item to the "receiver" address defined in the contract function arguments.

- `transaction` (NormalRedeemTransaction, required) — Transaction to be called.
- `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`
- `destination` (string, required)
- `waitForHash` (boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.

### DecentRedeem

If your contract exists on a chain supported by Decent, pass this object in order to call it.

- `type` (enum, required)
  - Allowed values: `decent`
- `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 receiving
- `contractAddress` (string, required) — The contract address which will be called on the destination chain
- `contractData` (string, required)
- `cost` (DecentRedeemCost, required) — Amount of the token on the destination chain you will be receiving
- `waitForHash` (boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.

### TokenSubtotalAmount

Number of tokens, from 0 to 1,000,000,000,000 inclusive. String values must be a plain decimal with at most 12 integer digits and 18 fractional digits.

- double
- string

### SafeMintRedeemTransaction

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

### ReturnedTokenIdRedeemTransaction

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

### KnownTokenIdRedeemTransaction

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

### NormalRedeemTransaction

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

### DecentRedeemCost

Amount of the token on the destination chain you will be receiving

- `isNative` (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

## Examples

**Request**

```json
{
  "merchantId": "string",
  "subtotal": {
    "cents": 1,
    "currency": "USD"
  },
  "transactionData": {
    "transaction": {
      "data": "string",
      "to": "string"
    },
    "type": "safeMint"
  }
}
```

**Response**

```json
{
  "message": "string",
  "validBefore": "string",
  "nonce": "string",
  "creditsRawAmount": 1.1
}
```

**SDK Code**

```python
import requests

url = "https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg"

payload = {
    "merchantId": "string",
    "subtotal": {
        "cents": 1,
        "currency": "USD"
    },
    "transactionData": {
        "transaction": {
            "data": "string",
            "to": "string"
        },
        "type": "safeMint"
    }
}
headers = {
    "x-coinflow-auth-wallet": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg';
const options = {
  method: 'POST',
  headers: {'x-coinflow-auth-wallet': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"merchantId":"string","subtotal":{"cents":1,"currency":"USD"},"transactionData":{"transaction":{"data":"string","to":"string"},"type":"safeMint"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg"

	payload := strings.NewReader("{\n  \"merchantId\": \"string\",\n  \"subtotal\": {\n    \"cents\": 1,\n    \"currency\": \"USD\"\n  },\n  \"transactionData\": {\n    \"transaction\": {\n      \"data\": \"string\",\n      \"to\": \"string\"\n    },\n    \"type\": \"safeMint\"\n  }\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))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg")

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\": \"string\",\n  \"subtotal\": {\n    \"cents\": 1,\n    \"currency\": \"USD\"\n  },\n  \"transactionData\": {\n    \"transaction\": {\n      \"data\": \"string\",\n      \"to\": \"string\"\n    },\n    \"type\": \"safeMint\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
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/creditsAuthMsg")
  .header("x-coinflow-auth-wallet", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"merchantId\": \"string\",\n  \"subtotal\": {\n    \"cents\": 1,\n    \"currency\": \"USD\"\n  },\n  \"transactionData\": {\n    \"transaction\": {\n      \"data\": \"string\",\n      \"to\": \"string\"\n    },\n    \"type\": \"safeMint\"\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg', [
  'body' => '{
  "merchantId": "string",
  "subtotal": {
    "cents": 1,
    "currency": "USD"
  },
  "transactionData": {
    "transaction": {
      "data": "string",
      "to": "string"
    },
    "type": "safeMint"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-coinflow-auth-wallet' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg");
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\": \"string\",\n  \"subtotal\": {\n    \"cents\": 1,\n    \"currency\": \"USD\"\n  },\n  \"transactionData\": {\n    \"transaction\": {\n      \"data\": \"string\",\n      \"to\": \"string\"\n    },\n    \"type\": \"safeMint\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-coinflow-auth-wallet": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "merchantId": "string",
  "subtotal": [
    "cents": 1,
    "currency": "USD"
  ],
  "transactionData": [
    "transaction": [
      "data": "string",
      "to": "string"
    ],
    "type": "safeMint"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.coinflow.cash/api/redeem/evm/creditsAuthMsg")! 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()
```