user3697484
user3697484

Reputation:

How to get the woocommerce credit card form data?

The woocommerce credit card form is added like this : https://docs.woocommerce.com/wc-apidocs/source-class-WC_Payment_Gateway_CC.html#50-98

public function payment_fields() {
      $cc_form = new WC_Payment_Gateway_CC();
      $cc_form->id       = $this->id;
      $cc_form->supports = $this->supports;
      $cc_form->form();
}

but i have to pass the credit card details to API in order to get a response

    public function process_payment( $order_id ) {
      global $woocommerce;
      $customer_order = new WC_Order( $order_id );
      $order_data = $customer_order->get_data();
         $creditcardnumber = ??;
    }

How can get the credit card number and other details so that i can post it?

Upvotes: 1

Views: 2307

Answers (1)

avila
avila

Reputation: 61

It Works for me:

WC()->checkout()->getValue('your-id-card-number')

Upvotes: 1

Related Questions