3

We're using the Stripe Payment Gateway with Cartthrob and the payments are going through and it's working just fine. The only problem is that in the Stripe Dashboard the customer's name, address, and more is set as null.

So as I tried to locate the cause of the problem I looked at a few of the files, and the Cartthrob_stripe.php file seems to be where the problem is. It all lines up with the stripe.js documentation that they have, and it has the section that creates a token to see if it's cool to pass through, and then passes through that information. I think it's on the second pass after discovering that there is no error that it doesn't keep the customer's name & address info, and only sends through the essentials. But I can't test out my theories on how to fix this without making actual payments as Stripe in test mode doesn't send the information to the Stripe dashboard. So I won't know if what I did just worked or not.

I'm hoping to get either a solution to this or some tips on how I might properly test my theories. Any help is appreciated, and anyway that I can help with getting the solution together, let me know. Thank you

0

Looking at the code, CartThrob requires that you have the address info inside form inputs with specific IDs.

address_line1: CartthrobTokenizer.val("#address"),
address_line2: CartthrobTokenizer.val("#address2"),
address_city:  CartthrobTokenizer.val("#city"),
address_state: CartthrobTokenizer.val("#state"),
address_zip: CartthrobTokenizer.val("#zip")

This is a little odd to me, since unless you are using a single-page checkout, by the time you get to payment, the address info will likely only be displayed as plain text on screen, as it's been entered in earlier steps.

However, the easy way to fix this without hacking the CartThrob files is to simply add hidden inputs to your checkout form.

<input type="hidden" name="address" id="address" value="{customer_address}" />
<input type="hidden" name="address2" id="address2" value="{customer_address2}" />
<input type="hidden" name="city" id="city" value="{customer_city}" />
<input type="hidden" name="state" id="state" value="{customer_state}" />
<input type="hidden" name="zip" id="zip" value="{customer_zip}" />

One thing re: Test Mode - you can certainly see these transactions in your dashboard - just flip the switch to TEST.

Stripe Live/Test switch

This switch doesn't "turn" Test Mode on or off - it merely displays Live vs Test data/transactions.

| improve this answer | |
  • Thank you for the help, the test mode slider in the dashboard slipped right by me. I ended up figuring out the problem, it being that we give 2 payment options: credit card or pay pal. The pay pal and the credit card form (stripe) used the same ids for the different fields. The pay pal form came first in the code and so it was always grabbing the empty fields and not the filled out ones. So all I have to do is change some id's, didn't see that one coming. – Colten Jul 12 '14 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.