Title: Problem with tokenization developing a custom gateway
Last modified: April 30, 2018

---

# Problem with tokenization developing a custom gateway

 *  Resolved [Edwin Xico (XicoOfficial)](https://wordpress.org/support/users/xicoofficial/)
 * (@xicoofficial)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/problem-with-tokenization-developing-a-custom-gateway/)
 * Hello everyone and thanks so much in advance for your support,
 * I am trying to extend a custom payment gateway using tokenization for woocommerce
   but I am having a problem that may be too obvious but i’ve spent all afternoon
   trying to figure out with no luck.
 * So, I have developed a custom payment gateway fully funtional extending the WC_Payment_Gateway_CC
   with:
 * `$this->supports = array( 'default_credit_card_form');`
 * To retrive the credit card information withing the class I use:
 *     ```
       $_POST['{payment method id}-card-number'];
       $_POST['{payment method id}-card-expiry'];
        $_POST['{payment method id}-card-cvc'];
       ```
   
 * I now want to extend it to use ‘tokenization’ so the first(and only) thing I 
   did was changing the “supports” line to:
 * `$this->supports = array( 'default_credit_card_form', 'tokenization' );`
 * After I did that suddently the credit card information is no longer in the $_POST
   variable. The $_POST variable I get now is.
 * `$[POST]:{"payment_method":"{payment method id}","wc-{payment method id}-payment-
   token":"new","woocommerce_pay":"1","_wpnonce":"d1d883779d","_wp_http_referer":"\/
   checkout\/order-pay\/77\/?pay_for_order=true&key=wc_order_5ae638306f334"}`
 * Does anyone how how do I get the credit card information from the form when ‘
   tokenization’ is supported?
 * Thanks againg for your help. I’ve spent a few hours reading through documentation
   and forums and have no idea what else to try.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Edwin Xico (XicoOfficial)](https://wordpress.org/support/users/xicoofficial/)
 * (@xicoofficial)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/problem-with-tokenization-developing-a-custom-gateway/#post-10234268)
 * A quick update in case somebody else runs into an issue like this.
 * So after looking closely to the form html code generated by ‘default_credit_card_form’
   I realized that it changed after I added tokenization.
 * When I added ‘tokenization’ every input field no longer has the ‘name’ atribute.
   Here is an example with the Credit Card Number:
 * Before adding ‘tokenization’
    `<input id="wowp_pcwpg_pagalocard-card-number" 
   class="input-text wc-credit-card-form-card-number" inputmode="numeric" autocomplete
   ="cc-number" autocorrect="no" autocapitalize="no" spellcheck="no" type="tel" 
   placeholder="•••• •••• •••• ••••" name="wowp_pcwpg_pagalocard-card-number">`
 * After adding ‘tokenization’
    `<input id="wowp_pcwpg_pagalocard-card-number" class
   ="input-text wc-credit-card-form-card-number" inputmode="numeric" autocomplete
   ="cc-number" autocorrect="no" autocapitalize="no" spellcheck="no" type="tel" 
   placeholder="•••• •••• •••• ••••">`
 * See how that last input element doesnt have a name atribute at the end.
 * So at the end I had to use the `'woocommerce_credit_card_form_fields'` filter
   to generate the forms and manually adding each name attribute to the form fields.
 * After that everything seems to work just fine, but yet, I don’t know if that’s
   what ‘tokenization’ is supposed to do or if I am doing something wrong.
 * So any ideas are still very well appreciated. Thank you.
 *  Plugin Support [Hannah S.L.](https://wordpress.org/support/users/fernashes/)
 * (@fernashes)
 * Automattic Happiness Engineer
 * [8 years ago](https://wordpress.org/support/topic/problem-with-tokenization-developing-a-custom-gateway/#post-10241738)
 * This is beyond the level of support most people in the forums can offer, but 
   I’ll leave this thread open in case anyone wants to chime in.
 *  Plugin Support [Hannah S.L.](https://wordpress.org/support/users/fernashes/)
 * (@fernashes)
 * Automattic Happiness Engineer
 * [8 years ago](https://wordpress.org/support/topic/problem-with-tokenization-developing-a-custom-gateway/#post-10272952)
 * We haven’t heard back from anyone in a while, so I’m going to mark this as resolved–
   if you have any further questions, you can start a new thread.
 * If you need further help with this, then I highly recommend contacting one of
   the services on our customizations page: [https://woocommerce.com/customizations/](https://woocommerce.com/customizations/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Problem with tokenization developing a custom gateway’ is closed to new
replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [$_POST](https://wordpress.org/support/topic-tag/_post/)
 * [custom payment gateway](https://wordpress.org/support/topic-tag/custom-payment-gateway/)
 * [payment gateway](https://wordpress.org/support/topic-tag/payment-gateway/)

 * 3 replies
 * 2 participants
 * Last reply from: [Hannah S.L.](https://wordpress.org/support/users/fernashes/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/problem-with-tokenization-developing-a-custom-gateway/#post-10272952)
 * Status: resolved