August 11, 2014

How to get Billing and Shipping Address data from Stripe Checkout

Stripe Checkout is an awesome tool for Stripe users to collect credit card info in a beautiful and PCI compliant way.

Up until a couple of months ago, Stripe supported developers requesting both the billing and shipping address from their customers. Since then, they’ve deprecated billing and shipping address to just billing address (renaming it address), and now they have also deprecated address support opting for just zip code support. However if you still want to get access to a customer’s billing and shipping address, fear not, the ability is still there, just a bit undocumented.

NOTE: This feature is deprecated, it might be removed at any time, or may just start acting weird.

 

Check it out:


So here’s how to implement it:

Simple Integration (Pure HTML)

You’ll want to add two data attributes to your Stripe checkout script tag: data-billingAddress='true' and data-shippingAddress='true'

Your html should look something like this:

When the form submits to your server, you’ll see this all this info added as part of the form:

(Also, the billing address info will also get added to the card token automagically.)

 

Custom Integration (JS)

The custom integration route is just a simple, just add shippingAddress=true and billingAddress=true to the object passed into your Stripe handler’s open method, like below: 

The billing info will automatically be part of the card and token, the shipping info gets passed to your token callback as a second parameter (which I called args). The contents args look like this:

 

Notes

  • You cannot just request the shipping address, if you set shippingAddress=true and billingAddress=false the user will be prompted for a billing address.
  • Funky stuff will happen if you try to use the address functionality and the new zipCode option. If you use address, Stripe will grab the zip code that the customer entered as part of their billing address to do a zip code check.

P.S. Need help with your Stripe integration? Feel free to send me an email [email protected]

15 Comments

Leave a Reply to Vehid Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>