Create Pix Payment
POST https://api-sandbox.coinflow.cash/api/checkout/pix Content-Type: application/json
Initiates a Pix payment order. Returns a BR code used to pay the order. Must be paid before the returned expiration date (5 minutes).
Reference: /api-reference/api-reference/checkout/create-pix-payment
Authentication
x-coinflow-auth-session-keyheader (required) — The session key generated for the end user - see /api-reference/api-reference/authentication/get-session-keyx-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-keyx-coinflow-auth-user-idheader (required) — The external identifier of the end user - see /api-reference/api-reference/authentication/get-session-key
Request
Body (application/json)
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
email(string, required)merchantId(string, required) — Merchant IdentifiercustomPayInFees(list of object, optional)fee(object or object, required)- object
cents(double, 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:
percent(double, required, nullable)isFixed(boolean, required)
- object
cents(double, required, nullable)currency(double, required, nullable)percent(double, required)isFixed(boolean, required)
- object
lineItemLabel(string, required)
customerInfo(object or object, optional)- SplitNameCustomerInfo
firstName(string, required)lastName(string, required)verificationId(string, optional)displayName(string, optional)address(string, optional)city(string, optional)state(string, optional)zip(string, optional)country(string, optional)ip(string, optional)lat(string, optional)lng(string, optional)dob(string, optional) — Date of birth in YYYY-MM-DD formatemail(string, optional)
- NameCustomerInfo
verificationId(string, optional)displayName(string, optional)address(string, optional)city(string, optional)state(string, optional)zip(string, optional)country(string, optional)ip(string, optional)lat(string, optional)lng(string, optional)dob(string, optional) — Date of birth in YYYY-MM-DD formatemail(string, optional)name(string, optional)
- SplitNameCustomerInfo
webhookInfo(object, optional)example(string, optional)
feePercentage(double, optional) — If this purchase is for a seller/submerchant where the marketplace takes a fee, this is the % fee which is taken from the subtotal amount.fixedFee(object, optional)cents(integer, required)
jwtToken(string, optional) — This is a token encoding the parameters for the request. Allows purchase parameters to be verified to prevent manipulation when the checkout page is presented to the user.rent(object, optional) — (Solana only) if your transaction requires a known amount of Rent to be paid, you can pass it here.lamports(string or double, required)
transactionData(object or object or object or object or object or object, optional) — (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
stellarTransaction(string, optional) — (Stellar only) Base64 XDR transaction string for executing a merchant contract call on a successful purchase. For transaction purchases, pass the base64 XDR string created using.toXDR()on a transaction built with generated TypeScript bindings (e.g.,NftClientWrapper.buildNftPurchaseTx). For direct USDC transfers (no merchant transaction), omit this field or pass undefined. Gas fees for the transaction will be automatically calculated and added to the total charged to the customer.settlementType(enum, optional)- Allowed values:
Credits,USDC
- Allowed values:
destinationAuthKey(string, optional) — If utilizing USDC settlement to addresses other than your main merchant settlement address. Utilize this destinationAuthKey which is a JWT encoded with the information for which address to send the USDC to.customerUsdcTransferData(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)
customerUsdcTransferDataV2(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)
userLocation(object, optional) — End-user geographic coordinates captured at the moment of the withdrawal request. Consumed byBlockingRuleMethod.GEOLOCATIONenforcement. Replay-of-different-coords bypass is prevented server-side: the first resolved {country, state} for a given (merchant, user) pair is pinned in Redis, and subsequent requests are evaluated against that pinned value regardless of the lat/lng they submit.lat(double, required)lng(double, required)
overrideChargebackProtectionDecision(boolean, optional)doNotReviewChargebackProtection(boolean, optional)
Response
200
Ok
paymentId(string, required) — The ID of the payment that was created.brCode(string, required) — QR code to display to complete payment.quote(object, required)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:
expires(string, required) — BR Code expiration
Examples
Request
{
"subtotal": {
"cents": 2599,
"currency": "USD"
},
"email": "customer@example.com",
"merchantId": "merchant_12345"
}
Response
{
"paymentId": "pay_9876543210abcdef",
"brCode": "00020126580014BR.GOV.BCB.PIX0136a1b2c3d4e5f6789012345678901234565204000053039865406259.995802BR5925Merchant Store6009Sao Paulo61080540900062070503***63041D3D",
"quote": {
"cents": 2599,
"currency": "USD"
},
"expires": "2024-06-01T15:45:00Z"
}
SDK Code
import requests
url = "https://api-sandbox.coinflow.cash/api/checkout/pix"
payload = {
"subtotal": {
"cents": 2599,
"currency": "USD"
},
"email": "customer@example.com",
"merchantId": "merchant_12345"
}
headers = {
"x-coinflow-auth-session-key": "<apiKey>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = 'https://api-sandbox.coinflow.cash/api/checkout/pix';
const options = {
method: 'POST',
headers: {'x-coinflow-auth-session-key': '<apiKey>', 'Content-Type': 'application/json'},
body: '{"subtotal":{"cents":2599,"currency":"USD"},"email":"customer@example.com","merchantId":"merchant_12345"}'
};
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/checkout/pix"
payload := strings.NewReader("{\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"email\": \"customer@example.com\",\n \"merchantId\": \"merchant_12345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-coinflow-auth-session-key", "<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/checkout/pix")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-coinflow-auth-session-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"email\": \"customer@example.com\",\n \"merchantId\": \"merchant_12345\"\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/checkout/pix")
.header("x-coinflow-auth-session-key", "<apiKey>")
.header("Content-Type", "application/json")
.body("{\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"email\": \"customer@example.com\",\n \"merchantId\": \"merchant_12345\"\n}")
.asString();
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api-sandbox.coinflow.cash/api/checkout/pix', [
'body' => '{
"subtotal": {
"cents": 2599,
"currency": "USD"
},
"email": "customer@example.com",
"merchantId": "merchant_12345"
}',
'headers' => [
'Content-Type' => 'application/json',
'x-coinflow-auth-session-key' => '<apiKey>',
],
]);
echo $response->getBody();
using RestSharp;
var client = new RestClient("https://api-sandbox.coinflow.cash/api/checkout/pix");
var request = new RestRequest(Method.POST);
request.AddHeader("x-coinflow-auth-session-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"subtotal\": {\n \"cents\": 2599,\n \"currency\": \"USD\"\n },\n \"email\": \"customer@example.com\",\n \"merchantId\": \"merchant_12345\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation
let headers = [
"x-coinflow-auth-session-key": "<apiKey>",
"Content-Type": "application/json"
]
let parameters = [
"subtotal": [
"cents": 2599,
"currency": "USD"
],
"email": "customer@example.com",
"merchantId": "merchant_12345"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.coinflow.cash/api/checkout/pix")! 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()