⚙️
mtnAPI Docs 👨🏻‍🔬
  • mtnAPI Overview
    • Introduction
    • Terminology
  • Getting Started
  • How It Works
  • FAQ
  • Reference
    • API Reference
      • Pay
        • Token Discount Payments
        • Token Gated Payments
        • Token Swapped Payments
        • SOL & SPL Payments
      • Mint
        • Candy Machine
        • Metadata
        • Upload
      • Intent Key
      • Reference Key
      • Status
      • Validate
  • Supported Tokens
  • Testing
Powered by GitBook
On this page
  1. Reference
  2. API Reference
  3. Pay

SOL & SPL Payments

PreviousToken Swapped PaymentsNextMint

Last updated 2 years ago

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 of the API!

Example (SOL Payment)

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

#get a reference key
ref_url = 'http://api.mtnapi.com/ref'
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 = 'http://api.mtnapi.com/pay'
#query string parameters
params = {'wallet': wallet, 'size' : size, 'payerToken' : payerToken, 'ref' : ref}
#request body
data = {'account': account} 
#make the POST request
r = requests.post(url = api_url, params=params, json=data)

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

print(solana_pay_url)
the rules