Take a payment on a terminal
Register a terminal, start a session, and read the transaction when the payer finishes.
To take an in-person payment, register the card reader as a terminal at one of the merchant's locations, then start a terminal session that prompts the payer to pay on that device.
Location and terminal
Create a location for the account with POST /v1/locations. GET /v1/locations lists them, and PATCH and DELETE update or remove one.
Register the device with POST /v1/terminals, sending processor, processorTerminalId, and locationId. processorTerminalId is the reader id at Stripe or the POIID at Adyen. dhango compares it with terminals already registered under the credential, ignoring case. name is optional and defaults to the processor terminal id.
Use POST /v1/terminals/{id}/activate and /deactivate to control whether a device can take payments. PATCH /v1/terminals/{id} updates a terminal, and GET /v1/terminals lists them. Add includeInactive to the list call to include deactivated devices.
Session
Start a payment on the device with POST /v1/terminalSessions. Send terminalId to pick the device, plus payer, amount, and payerFee. As on pay, amount includes the payer fee, and shipping, tax, line items, and metadata use the same fields as the pay request. The call returns 201 with the new session id.
To find out when the payer has finished, poll GET /v1/terminalSessions/{id} until transactionId is set, or wait for the TransactionEvent webhook.
To stop a session, call POST /v1/terminalSessions/{id}/cancel. It returns 202 when the cancel is accepted.
When your platform acts for a merchant, send your platform key and secret plus the merchant's accountKey. Once the merchant is active, that combination can also manage its locations and terminals.
curl -s -u "$DHANGO_KEY:$DHANGO_SECRET" \ -H "Content-Type: application/json" \ -H "accountKey: $ACCOUNT_KEY" \ -d '{"terminalId":41,"payer":"Ada Lovelace","amount":18.00,"payerFee":0}' \ https://api.dhangodemo.com/v1/terminalSessionsawait fetch("https://api.dhangodemo.com/v1/terminalSessions", { method: "POST", headers: { Authorization: "Basic " + Buffer.from(process.env.DHANGO_KEY + ":" + process.env.DHANGO_SECRET).toString("base64"), "Content-Type": "application/json", accountKey: process.env.ACCOUNT_KEY }, body: JSON.stringify({ terminalId: 41, payer: "Ada Lovelace", amount: 18, payerFee: 0 })});import os, uuid, requestsauth = (os.environ["DHANGO_KEY"], os.environ["DHANGO_SECRET"])headers = {"accountKey": os.environ["ACCOUNT_KEY"]}response = requests.post( "https://api.dhangodemo.com/v1/terminalSessions", auth=auth, headers=headers, json={ "terminalId": 41, "payer": "Ada Lovelace", "amount": 18.0, "payerFee": 0 },)response.raise_for_status()session_id = response.json()["id"]session = requests.get( f"https://api.dhangodemo.com/v1/terminalSessions/{session_id}", auth=auth, headers=headers,).json()