0
votes

First time I am working with Payment System with PHP and Stripe API.

I have html form where user can Add their credit card info. Form fields are bellow :

  1. Card Number
  2. Month
  3. Year
  4. CVC

I can successfully add user credit card to my stripe account as Customer Account.

Now After added the credit card and I can get the card details using stripe API and...

  • Is it require to show the credit card number to the form field called Card Number ?

  • If so, then I can't see any full credit card number, I can see one of stripe object called last4. I know it's a last 4 digit of user credit card

  • Okey, If I show only 4 digit to the Card Number field then when I update the form It's showing The card number is not a valid credit card number. because the field is only showing 4 digit

  • If I again enter my card number to that Card Number field then it's successfully updated.

Now how can I update the user credit card without again enter the credit card number to the Card Number field ?

Update :

This is the Payment information form image : enter image description here

and Update Code is following :

$updateCustomer = \Stripe\Customer::retrieve("$acc_id");
$updateCustomer->description = "Customer account of $fname_db $lname_db - #$u_id ($accountFor Account)";
$updateCustomer->source = "$stripToken";
$updateCustomer->save();        
1
i think your looking for something like: support.stripe.com/questions/…user6763587
@nogad I can add, update and can get the customer details with all info from my stripe account. But my questions is. Is it require to show the full credit number to the form ? If Yes, then I can't see full credit card number. If no, then user have to again enter their credit card number to update the payment details ?shibbir ahmed
i dont know what "form" your talking about.user6763587
I have a website where in user profile section user can add their credit card details. I am using a html for to add credit card details.shibbir ahmed
NEVER Store the customers credit card number on your site, you're asking for trouble. Stripe will store this in their API. If you want to emulate some section where the user can change their card number, then get the last 4 digits back from Stripe and pad the rest of the number with **** **** **** 9424, from a UX perspective the customer can see, "oh this is my card identified by the last 4 digits, looks like I can update it here too"Alex

1 Answers

-1
votes

By design, Stripe's API will not return the full card number. Unless you are PCI certified yourself, your server should never have access to the full card numbers.

In order to create a charge using a saved customer, you simply need to pass the customer ID in the customer parameter.

This tutorial explains how to create customers then create charges using the customers.