Invoices vs orders: These guides walk through invoices (formal billing, line items, publish). The collect flow is the same for orders — use /v1/orders/* instead of /v1/invoices/* and set source_type: "ORDER" on the checkout session. See Orders and Parties & counterparties .Hosted checkout: To skip party, invoice, session, and execute steps entirely, see Hosted checkout .
End-to-end invoice collection with requests. For cURL and Node.js in parallel, see Quick Start .
Prerequisites
Python 3.9+
pip install requests
API credentials from the merchant portal (server-side only)
Steps
Authenticate
import requests
BASE_URL = "https://api.heydollr.app"
res = requests.post( f " { BASE_URL } /v1/jwt/client/obtain/token" , json = {
"client_id" : "YOUR_CLIENT_ID" ,
"client_secret" : "YOUR_CLIENT_SECRET" ,
})
token = res.json()[ "access_token" ]
headers = { "Authorization" : f "Bearer { token } " , "Content-Type" : "application/json" }
Party and counterparty
party = requests.post( f " { BASE_URL } /v1/parties/create" , headers = headers, json = {
"fullname" : "Amara Kamara" , "phone" : "231771234567" ,
"email" : "amara@example.com" , "country_code" : "LR" ,
}).json()
cp = requests.post( f " { BASE_URL } /v1/counterparties/create" , headers = headers, json = {
"relationship_type" : "CUSTOMER" , "party_id" : party[ "id" ],
}).json()
Invoice → publish
invoice = requests.post( f " { BASE_URL } /v1/invoices/create" , headers = headers, json = {
"counterparty_id" : cp[ "id" ], "currency" : "USD" ,
"note" : "Consulting services" , "fee_bearer" : "PAYER" , "as_payment_link" : True ,
}).json()
requests.post(
f " { BASE_URL } /v1/invoices/ { invoice[ 'id' ] } /items/add" ,
headers = headers,
json = { "name" : "Strategy Session" , "currency" : "USD" , "qty" : 1 , "amount" : 250.00 },
)
requests.put( f " { BASE_URL } /v1/invoices/publish/ { invoice[ 'id' ] } " , headers = headers)
Execute collection
import uuid
session = requests.post( f " { BASE_URL } /v1/sessions/checkout" , headers = headers, json = {
"source_id" : invoice[ "id" ], "source_type" : "INVOICE" ,
}).json()
account = requests.post(
f " { BASE_URL } /v1/payment-accounts/create" ,
headers = headers, params = { "operation_type" : "COLLECTION" },
json = {
"account_name" : "Amara MTN Wallet" ,
"provider" : "MTN_MOMO_LBR" , "method" : "MTN_MOMO_LBR" ,
"party_id" : party[ "id" ], "country_code" : "LR" ,
"insensitive_account_number" : "231771234567" ,
},
).json()
reference_id = str (uuid.uuid4())
requests.post( f " { BASE_URL } /v1/executions/collection" , headers = headers, json = {
"session_id" : str (session[ "id" ]),
"payment_account_id" : str (account[ "id" ]),
"currency" : "USD" ,
"reference_id" : reference_id,
})
Poll status
status = requests.get(
f " { BASE_URL } /v1/status/collection/ { reference_id } " ,
headers = headers,
).json()
Try it yourself
Hosted checkout Mobile money and card on a Dollr-hosted page — fastest path.
Orders Same collect flow with source_type: ORDER and /v1/orders/*.
Direct checkout One API call to create source — API-embedded flow.
Last modified on May 22, 2026