Powered by Coinflow
Payments · Documentation
Operational

Cash App Checkout

POST https://api-sandbox.coinflow.cash/api/checkout/cashapp/{merchantId} Content-Type: application/json

Initiates the checkout for a Cash App Payment

Reference: /api-reference/api-reference/checkout/cash-app-checkout

Authentication

  • x-coinflow-auth-session-key header (required) — The session key generated for the end user - see /api-reference/api-reference/authentication/get-session-key
  • x-coinflow-auth-wallet header (required) — The web3 wallet of the end user - see /api-reference/api-reference/authentication/get-session-key
  • x-coinflow-auth-blockchain header (required) — The blockchain associated with the end user - see /api-reference/api-reference/authentication/get-session-key
  • x-coinflow-auth-user-id header (required) — The external identifier of the end user - see /api-reference/api-reference/authentication/get-session-key
  • Authorization header (required) — The API key of the merchant - see /api-reference/api-reference/authentication/get-session-key

Request

Path parameters

  • merchantId (string, required)

Headers

  • x-device-id (string, optional) — - (Optional) If you are using Coinflow Chargeback Protection, you must pass the device id of the customer’s device.
  • x-coinflow-client-ip (string, optional)

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
    • Cents
      • cents (integer, required)
    • TokenSubtotal
      • address (string, required) — The tokens address Solana - Token Mint Address Evm - Token Contract Address
      • amount (double or string, required) — Number of tokens
      • decimals (double, optional) — Number of decimals for the token
  • customPayInFees (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
        • percent (double, required, nullable)
        • isFixed (boolean, required)
      • object
        • cents (double, required, nullable)
        • currency (double, required, nullable)
        • percent (double, required)
        • isFixed (boolean, required)
    • 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 format
      • email (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 format
      • email (string, optional)
      • name (string, optional)
  • 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
      • 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
      • 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 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
      • 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
      • 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
      • 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 (object, required) — 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
      • waitForHash (boolean, optional) — Whether the UI should wait for the transaction to be sent and the hash to be returned.
  • 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
  • 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.
  • userLocation (object, optional) — End-user geographic coordinates captured at the moment of the withdrawal request. Consumed by BlockingRuleMethod.GEOLOCATION enforcement. 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)
  • email (string, optional)

Response

200

Ok

  • expiresAt (datetime, required)
  • cashAppLink (string, required)
  • paymentId (string, required)

Examples

Request

{
  "subtotal": {
    "cents": 1500,
    "currency": "USD"
  }
}

Response

{
  "expiresAt": "2024-07-01T15:45:00Z",
  "cashAppLink": "https://cash.app/pay/merchant12345/checkout",
  "paymentId": "pay_9876543210abcdef"
}

SDK Code

import requests

url = "https://api-sandbox.coinflow.cash/api/checkout/cashapp/merchantId"

payload = { "subtotal": {
        "cents": 1500,
        "currency": "USD"
    } }
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/cashapp/merchantId';
const options = {
  method: 'POST',
  headers: {'x-coinflow-auth-session-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"subtotal":{"cents":1500,"currency":"USD"}}'
};

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/cashapp/merchantId"

	payload := strings.NewReader("{\n  \"subtotal\": {\n    \"cents\": 1500,\n    \"currency\": \"USD\"\n  }\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/cashapp/merchantId")

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\": 1500,\n    \"currency\": \"USD\"\n  }\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/cashapp/merchantId")
  .header("x-coinflow-auth-session-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"subtotal\": {\n    \"cents\": 1500,\n    \"currency\": \"USD\"\n  }\n}")
  .asString();
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.coinflow.cash/api/checkout/cashapp/merchantId', [
  'body' => '{
  "subtotal": {
    "cents": 1500,
    "currency": "USD"
  }
}',
  '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/cashapp/merchantId");
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\": 1500,\n    \"currency\": \"USD\"\n  }\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": 1500,
    "currency": "USD"
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.coinflow.cash/api/checkout/cashapp/merchantId")! 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()