Customising your Stripe integration

If you'd like to customise your Stripe integration, to provide yourself and Quaderno with more information about your customers, we've made it easy to do!

Customising the customer billing info

You might want to customise the billing info on your Stripe-generated invoices. You can do this in two main ways (with a bonus third way just for Quaderno customers!).

1. On the front-end

You can add extra info when you tokenise the card in the  custom form on your front-end, like so:

Stripe.card.createToken({
  number: $('.card-number').val(),
  cvc: $('.card-cvc').val(),
  exp_month: $('.card-expiry-month').val(),
  exp_year: $('.card-expiry-year').val(),
  name: $('.customer-name').val(),
  address_line1: $('.street-line1').val(),
  address_line2: $('.street-line2').val(),
  address_city: $('.city').val(),
  address_state: $('.region').val(),
  address_zip: $('.postal-code').val(),
  address_country: $('.country').val() // 2-letter ISO code
}, stripeResponseHandler);

Here we have added the customer's name and address information while creating the token, so that in Stripe's backend the auto-created customer will have all the right information.

2. On the back-end

You can also use the metadata fields available when you create the Stripe Customer on your back end. We're a Ruby shop, so here's an example of us doing this in a Rails back-end:

customer = Stripe::Customer.create(
  :description => 'Reynholm Industries',
  :email => 'billing@reynholm.co.uk',
  :card => 'tok_103NCO2eZvKYlo2Cc4lerc1E', # obtained with Stripe.js
  :metadata => {
    :street_line_1 => '123 Carenden Road',
    :street_line_2 => '',
    :city => 'London',
    :region => 'London',
    :postal_code => 'EC5M 8AJ',
    :country => 'GB', # 2-letter ISO code
  }
)

All the metadata is optional. Quaderno can make sense of the following fields:

Metadata Description
first_name Customer's first name (only for consumers)
last_name Customer's last name (only for consumers)
contact_person  Billing contact person (only for businesses)
street_line_1 Billing street (1 of 2 fields)
street_line_2 Billing street (2 of 2 fields)
city Billing city
region Billing region or state
postal_code Billing postal code (ZIP)
country Billing country (2-letter ISO code)
vat_number Billing VAT number
language Customer's language (2-letter ISO code). All receipts will be sent in that language
   

3. (Bonus) Use Quaderno Checkout

Quaderno Checkout is the best billing flow for web or mobile, and it builds on top of Quaderno.js to provide your uses with a streamlined, mobile-ready payment experience that is constantly improving. Using Quaderno Checkout, it's easy to add some custom customer billing info as needed. Check it out  here.

Customising the transaction

You might also want to customise both your charges and your subscriptions on Stripe. We are all for it, allowing you to set the tax rates you want to apply and to send us the IP address of the customer, as another piece of location confirmation evidence.

Here's a Rails example of us adding some relevant metadata to a couple of charges while creating them in Stripe:

Stripe::Charge.create(
  :amount => 2420, # total amount (taxes included)
  :currency => 'usd',
  :customer => customer.id,
  :description => 'The Neverending Story, Michael Ende (EPUB)',
  :metadata => {
    :tax_name => 'VAT',
    :tax_rate => 20,
    :ip_address => request.ip
  }
)

customer.subscriptions.create(
  :plan => 'awesome',
  :tax_percent => 20,
  :metadata => {
    :ip_address => request.ip
  }
)

In this case, you can even calculate the taxes with our  Tax API.

Still need help? Contact Us Contact Us