Charge a card token w/o a customer
Closed this issue · 8 comments
There does not seem to be any way to charge a card token that does not have a customer.
Before creating a PR I wanted to find out if you were open to having this in your lib.
You can create a charge w/o a customer w/ the Charges API, but I don't see a way to do that w/ your library..
Creating a charge without an associated customer can be accomplished like so:
$stripe = new Stripe('api_key');
$request = $stripe->charges->createChargeRequest(350, "usd");
$request->setCard(new CreateCardRequest(4242424242424242, 1, 2020));
$stripe->charges->createCharge($request);
@jlinn Is it possible to create a charge w/o an associated customer when you get the card token from the front-end via Stripe.js?
Ah, I see. Good call. Charges can now be created using tokens like so:
$stripe = new Stripe('api_key');
$request = $stripe->charges->createChargeRequest(350, "usd");
$request->setCard('token_from_stripe_js');
$stripe->charges->createCharge($request);
👍 Thanks
is it possible to create a charge request with just a card id?
It doesn't look like it. The Stripe docs indicate that a customer ID, card token, or full set of card data is required.