SOL & SPL Payments

Enables the developer to facilitate a transaction in which both the merchant and the customer want to use SOL or an SPL token (e.g. USDC) as payment.

Make sure you are following the rules of the API!

Example (SOL Payment)

import requests #make HTTP requests
import urllib.parse #encode the URL

#get a reference key
ref_url = ''
r = requests.get(url = ref_url)
ref = r.json()['ref']

wallet='Ar7XrWtrGsB2xCnrTFLs9HyJ1bA62gXCAUZa8Fa7VMc5' #receiver
account = 'DaNDvvjZ3gdhjxeA3jKLGPTF7kNU8HupKKEgVTuHQwLi' #payer 
payerToken = 'usdc'
size = 0.1

#base URL
api_url = ''
#query string parameters
params = {'wallet': wallet, 'size' : size, 'payerToken' : payerToken, 'ref' : ref}
#request body
data = {'account': account} 
#make the POST request
r = = api_url, params=params, json=data)

#encode the url
encoded_url = urllib.parse.quote(r.url)  
#append solana
solana_pay_url = 'solana:' + encoded_url


Last updated