Hi Faisal
I see that you've raised this through a ticket #59143 and we're investigating it at our end. We'll get back to you with more information through the ticket.
Adding to my question. Steps that i was taking to update card are below:
1. Got tmp_token from checkout.js of stripe.
2. Retrieve stripe customer object and update new token there.
3. Update chargebee payment token for that customer.
Getting exception in third step.
Hi Faisal
Thanks for the procedure!
We will discuss this with our team and get back to you.
As mentioned already, temp tokens cannot be passed twice. As you are passing the tmp_token at Stripe's end as well as at Chargebee's end, it fails.
Alternatively,
1. You could use the tmp_token to update the card details in Stripe and configure webhooks that will sync with Chargebee.
2. Update the card details in Stripe using the tmp-token and using the Stripe Card and Customer ID, you could pass Update Payment Method for a customer API to update in Chargebee.
3. Directly pass the tmp-token to Chargebee using Update Card for a customer API which will also update card details at Stripe and Chargebee.
Adding to my question. Steps that i was taking to update card are below:
1. Got tmp_token from checkout.js of stripe.
2. Retrieve stripe customer object and update new token there.
3. Update chargebee payment token for that customer.
Hope this clarifies.
Responded through ticket as well.
Faisal Rehman
Hi,
I am using stripe.js (checkout.js) and trying to update payment details of a customer. When i am submitting stripeToken (tmp_token) returned by checkout.js i am getting exception:
ChargeBee_PaymentException: Problem while updating the payment method. Error message : You cannot use a Stripe token more than once
Here is my code snippet:
try {
$result = \ChargeBee_Card::updateCardForCustomer($customerId, array(
"tmp_token" => $stripeToken));
$customer = $result->customer();
$card = $result->card();
Log::info("card update status from CB: ".json_encode($card));
return true;
} catch (\Exception $e) {
Log::error("Error occured in updating card in CB: ".$e);
return false;
}