Get payment status
Returns the status of a payment by invoice or transaction ID.
Parameters
Send as application/x-www-form-urlencoded.
typestringrequiredSelects the operation. Always
get_payment_statusfor this endpoint.tokenstringrequiredYour API token from Log in. See Authentication.
DCDial invoice ID.
ExampleINV-88812Gateway transaction ID.
Examplech_3Q8x2eYour DCDial company ID.
Example101
curl https://api.dcdial.com/api/ \ -d type=get_payment_status \ -d token="$DCDIAL_TOKEN" \ -d invoice_id=INV-88812 \ -d transaction_id=ch_3Q8x2e \ -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_status', 'token' => getenv('DCDIAL_TOKEN'), 'invoice_id' => 'INV-88812', 'transaction_id' => 'ch_3Q8x2e', '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_status", token: process.env.DCDIAL_TOKEN, invoice_id: "INV-88812", transaction_id: "ch_3Q8x2e", 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_status", "token": os.environ["DCDIAL_TOKEN"], "invoice_id": "INV-88812", "transaction_id": "ch_3Q8x2e", "company_id": 101, }, timeout=30,)response = r.json()["response"]if str(response.get("success")) != "1": raise RuntimeError(response.get("error")){ "response": { "invoice_id": "xxxxx", "transaction_id": "xxxxxxx", "amount": "xx.xx", "payment_time": "xxxxx-xx-xx xx:xx:xx", "first_name": "aaa", "last_name": "bbb", "account_id": "xxxxxx", "payment_error": "xxx", "last4": "xxxx", "payment_status": "succeeded", "success": 1 }}Try it