Create a payment link
Creates a secure payment link for an account. Send it yourself, or have DCDial text it to the account holder.
Set amount to fix the amount; add editable=Y to let the account holder change it. Payments show up in DCDial immediately and reduce the account balance.
Parameters
Send as application/x-www-form-urlencoded.
typestringrequiredSelects the operation. Always
get_payment_linkfor this endpoint.tokenstringrequiredYour API token from Log in. See Authentication.
Your reference for the account (its accountid).
ExampleACC-10045Your DCDial company ID.
Example101Amount to request. When set, the account holder cannot change it unless editable=Y.
Example150Y to let the account holder change the amount, N to lock it. Defaults to N.
One ofYN
curl https://api.dcdial.com/api/ \ -d type=get_payment_link \ -d token="$DCDIAL_TOKEN" \ -d account_id=ACC-10045 \ -d company_id=101<?php$ch = curl_init('https://api.dcdial.com/api/');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => http_build_query([ 'type' => 'get_payment_link', 'token' => getenv('DCDIAL_TOKEN'), 'account_id' => 'ACC-10045', 'company_id' => 101, ]),]);$result = json_decode(curl_exec($ch), true);curl_close($ch);
if (($result['response']['success'] ?? 0) != 1) { throw new RuntimeException($result['response']['error'] ?? 'Request failed');}const res = await fetch('https://api.dcdial.com/api/', { method: 'POST', body: new URLSearchParams({ type: "get_payment_link", token: process.env.DCDIAL_TOKEN, account_id: "ACC-10045", company_id: "101", }),});const { response } = await res.json();if (response.success != 1) throw new Error(response.error);import osimport requests
r = requests.post( "https://api.dcdial.com/api/", data={ "type": "get_payment_link", "token": os.environ["DCDIAL_TOKEN"], "account_id": "ACC-10045", "company_id": 101, }, timeout=30,)response = r.json()["response"]if str(response.get("success")) != "1": raise RuntimeError(response.get("error")){ "response": { "payment_link": "dclab.me/abc", "account_id": "00000", "success": "[1 or 0]" }}Try it