如何获取woocommerce信用卡表格数据?

时间:2019-06-29 16:33:59

标签: html wordpress post woocommerce payment-gateway

woowoo信用卡表单是这样添加的: 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();
}

但是我必须将信用卡详细信息传递给API才能获得响应

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

如何获取信用卡号和其他详细信息以便我可以发布?

1 个答案:

答案 0 :(得分:0)

对我有用:

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