Detaches a Source object from a Customer. The status of a source is changed to consumed when it is detached and it can no longer be used to create a charge.
curl https://api.stripe.com/v1/customers/cus_CBbg9PmQ9sLbmo/sources/src_1BnETLGswQrCoh0X5KOorXEP \
-u STRIPE_SECRET_KEY: \
-X DELETE
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
CkRest rest = new CkRest();
boolean success;
// URL: https://api.stripe.com/v1/customers/cus_CBbg9PmQ9sLbmo/sources/src_1BnETLGswQrCoh0X5KOorXEP
boolean bTls = true;
int port = 443;
boolean bAutoReconnect = true;
success = rest.Connect("api.stripe.com",port,bTls,bAutoReconnect);
if (success != true) {
System.out.println("ConnectFailReason: " + rest.get_ConnectFailReason());
System.out.println(rest.lastErrorText());
return;
}
rest.SetAuthBasic("STRIPE_SECRET_KEY","");
CkStringBuilder sbResponseBody = new CkStringBuilder();
success = rest.FullRequestNoBodySb("DELETE","/v1/customers/cus_CBbg9PmQ9sLbmo/sources/src_1BnETLGswQrCoh0X5KOorXEP",sbResponseBody);
if (success != true) {
System.out.println(rest.lastErrorText());
return;
}
CkJsonObject jsonResponse = new CkJsonObject();
jsonResponse.LoadSb(sbResponseBody);
String id;
String object;
int amount;
String client_secret;
int created;
String currency;
String flow;
boolean livemode;
boolean ownerAddress;
String ownerEmail;
boolean ownerName;
boolean ownerPhone;
boolean ownerVerified_address;
boolean ownerVerified_email;
boolean ownerVerified_name;
boolean ownerVerified_phone;
String receiverAddress;
int receiverAmount_charged;
int receiverAmount_received;
int receiverAmount_returned;
String receiverRefund_attributes_method;
String receiverRefund_attributes_status;
boolean statement_descriptor;
String status;
String type;
String usage;
String bitcoinAddress;
int bitcoinAmount;
int bitcoinAmount_charged;
int bitcoinAmount_received;
int bitcoinAmount_returned;
String bitcoinUri;
id = jsonResponse.stringOf("id");
object = jsonResponse.stringOf("object");
amount = jsonResponse.IntOf("amount");
client_secret = jsonResponse.stringOf("client_secret");
created = jsonResponse.IntOf("created");
currency = jsonResponse.stringOf("currency");
flow = jsonResponse.stringOf("flow");
livemode = jsonResponse.BoolOf("livemode");
ownerAddress = jsonResponse.IsNullOf("owner.address");
ownerEmail = jsonResponse.stringOf("owner.email");
ownerName = jsonResponse.IsNullOf("owner.name");
ownerPhone = jsonResponse.IsNullOf("owner.phone");
ownerVerified_address = jsonResponse.IsNullOf("owner.verified_address");
ownerVerified_email = jsonResponse.IsNullOf("owner.verified_email");
ownerVerified_name = jsonResponse.IsNullOf("owner.verified_name");
ownerVerified_phone = jsonResponse.IsNullOf("owner.verified_phone");
receiverAddress = jsonResponse.stringOf("receiver.address");
receiverAmount_charged = jsonResponse.IntOf("receiver.amount_charged");
receiverAmount_received = jsonResponse.IntOf("receiver.amount_received");
receiverAmount_returned = jsonResponse.IntOf("receiver.amount_returned");
receiverRefund_attributes_method = jsonResponse.stringOf("receiver.refund_attributes_method");
receiverRefund_attributes_status = jsonResponse.stringOf("receiver.refund_attributes_status");
statement_descriptor = jsonResponse.IsNullOf("statement_descriptor");
status = jsonResponse.stringOf("status");
type = jsonResponse.stringOf("type");
usage = jsonResponse.stringOf("usage");
bitcoinAddress = jsonResponse.stringOf("bitcoin.address");
bitcoinAmount = jsonResponse.IntOf("bitcoin.amount");
bitcoinAmount_charged = jsonResponse.IntOf("bitcoin.amount_charged");
bitcoinAmount_received = jsonResponse.IntOf("bitcoin.amount_received");
bitcoinAmount_returned = jsonResponse.IntOf("bitcoin.amount_returned");
bitcoinUri = jsonResponse.stringOf("bitcoin.uri");
}
}
{
"id": "src_1BnETLGswQrCoh0X5KOorXEP",
"object": "source",
"amount": 1000,
"client_secret": "src_client_secret_CBbgdvc1AflN5jN0wQevA2jA",
"created": 1516662783,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "consumed",
"type": "bitcoin",
"usage": "single_use",
"bitcoin": {
"address": "test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N",
"amount": 2371000,
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"uri": "bitcoin:test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N?amount=0.02371000"
}
}