Using Stripe.js
, I get a card token
that I can then use to charge via:
Stripe::Charge.create(
:amount => 400,
:currency => "usd",
:card => "tok_103rC02eZvKYlo2C2RD5docg", # obtained with Stripe.js,
:metadata => {'order_id' => '6735'}
)
Can I use the same card token
multiple times to charge the customer or is it 1 token/charge and any subsequent charge, I will have to grab a new token?
Retrying card issuer declines If your integration has retry logic in place to retry declined charges, be aware that card networks have rules in place for how many times you can reattempt a single charge. We recommend you not retry charges more than four times.
Recurring charges When payments fail, Stripe retries them using the Smart Retries feature. This automatically re-attempts payment when cards are declined according to your Dashboard settings.
Stripe Billing is the fastest way for your business to bill customers with subscriptions or invoices. Capture more revenue, support new products or business models, and accept recurring payments globally.
Have Stripe automatically charge a customer's stored payment method. Stripe can automatically attempt to pay an invoice if the customer has a payment method on file. You can choose to automatically charge a customer when you're creating an invoice or through the API.
Good question! When you use the token in that manner, it's immediately consumed, so it can't be used again. However, you can instead provide that token as the card
argument when creating a Customer object in Stripe. Then you can perform multiple charges against that Customer.
Hope that helps. Larry
PS I work on Support at Stripe.
There are two thing. One is token and one is card id. Token can be used one time. Also it has some time limit to use. Card id we get after save the card to cloud. We can use card id multiple time. Token gets generate through Public key. and this can not be use again. So You can use card id for payment multiple time
require_once APPPATH . 'libraries/Stripe.php';
Stripe::setApiKey("***********************"); //Put here your secrect key
//Add card and get token id.
$tokenDetail = Stripe_Token::create(array(
"currency" => "USD",
"card" => array(
"number" => '********', //$credit_card_number,
"exp_month" => '**', //$exp_date_month,
"exp_year" => '**', //$exp_date_year,
"cvc" => '***'//$cvv_number
)
));
$token = $tokenDetail->id;
Stripe::setApiKey("*********************"); ////Put here your secrect key
// Get card id by creating a Customer.
$customer = Stripe_Customer::create(array(
"source" => $tokenDetail->id,
"description" => "For testing purpose",
)
);
$response = Stripe_Charge::create(array(
"amount" => 100,
"currency" => "usd",
"customer" => $customer->id // obtained with Stripe.js
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With