Perl Stripe: Delete a Bank Account

Back to Index

Deletes a customer's bank account.

Documentation: https://stripe.com/docs/api/curl#customer_delete_bank_account

CURL Command

curl https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99 \
   -u STRIPE_SECRET_KEY: \
   -X DELETE

Perl Example

use chilkat();

$rest = chilkat::CkRest->new();

#  URL: https://api.stripe.com/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99
$bTls = 1;
$port = 443;
$bAutoReconnect = 1;
$success = $rest->Connect("api.stripe.com",$port,$bTls,$bAutoReconnect);
if ($success != 1) {
    print "ConnectFailReason: " . $rest->get_ConnectFailReason() . "\r\n";
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$rest->SetAuthBasic("STRIPE_SECRET_KEY","");

$sbResponseBody = chilkat::CkStringBuilder->new();
$success = $rest->FullRequestNoBodySb("DELETE","/v1/customers/cus_CBbg3iRMzWBjoe/sources/ba_1BnETKGswQrCoh0XzgjB3t99",$sbResponseBody);
if ($success != 1) {
    print $rest->lastErrorText() . "\r\n";
    exit;
}

$jsonResponse = chilkat::CkJsonObject->new();
$jsonResponse->LoadSb($sbResponseBody);

$deleted = $jsonResponse->BoolOf("deleted");
$id = $jsonResponse->stringOf("id");

Sample JSON Response Body

{
  "deleted": true,
  "id": "ba_1BnETKGswQrCoh0XzgjB3t99"
}