Home / Archive / Send Tax (e.g. VAT) to Stripe
Duplicate Snippet

Embed Snippet on Your Site

Send Tax (e.g. VAT) to Stripe

This code snippet will send the user’s VAT/TAX number to Stripe when that user registers for membership through Stripe Elements. The VAT/TAX number will be added to the user’s details in your Stripe dashboard.

This data will be added to the user’s account only for the new users registering after the code snippet is activated on the website.

Code Preview
php
<?php
add_action('mepr_stripe_create_customer_args', function ($args, $usr) {
  $vat = sanitize_text_field($_REQUEST['mepr_vat_number']);
  //Check one more time to make sure we have a vat number
  if (isset($vat) && !empty($vat)) {
    $tax_id = array(
      "type" => "eu_vat", //Replace the "eu_vat" value with the predefined value of another country to pass the Tax ID of different countries instead of the EU countries. Check countries from https://docs.stripe.com/billing/customer/tax-ids#supported-tax-id
      "value" => $vat
    );
    $args['tax_id_data'] = array($tax_id);
  }
  return $args;
}, 10, 2);

Comments

Add a Comment