Card on file using PHP


I’m using PHP and I’d like to create a form where a client could add a credit card to his file.

The client should be able to enter CC#, expiration date, CVV, and zip code. Is that even possible?


Is this walkthrough what you’re looking for?

This walkthrough has 3 steps - (1) create customer; (2) save card on customer; (3) use saved card for a transaction.

Obviously you’d save the card (steps 1 and 2) and then stop; and then when they came back to pay you’d follow step 3 (using the card-on-file token that you saved from step 2) in the walkthrough.


The customer already exists, and I don’t need to process a payment. So, yes, I only need to work on step 2. The problems is that I don’t see the code to render the credit card form where the client can type the CC info.


The form for the customer to input their card information is The Web Payments SDK. Instead of passing the generated token in to the CreatePayment request you instead pass it to the CreateCard to generate the card on file. :slightly_smiling_face:

1 Like

I folowing the instrucctions here:

The Console returns this:
POST 404

That’s line 10 in “Step 3: Add the card on file method”

Should I replace “fetch(‘/card’,” with something else?


Since I’m not using Node, It looks like I’ll have to write something in PHP that runs in the path contained in fetch. Is that correct?

I finally got it to work.


Glad to hear that you got it to work. :slightly_smiling_face: