The form handler that is run when adding a new payment method from the "my accounts" section will call your gateway's add_payment_method method.Īfter any validation (i.e. Step 2: Define A Method For Adding/Saving New Payment Methods From "My Account" Like other gateways features, this is defined in a gateway's _construct in an array called supports.Īdd tokenization to this array. We need to tell WooCommerce our gateway supports tokenization. Since Simplify deals with credit cards, we extend the credit card gateway.Ĭlass WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway_CC Step 1: 'Supports' Array You can also implement your own gateway base by extending the abstract WC_Payment_Gateway class, if neither of those classes work for you. They contain some useful code for generating payment forms on checkout and should hopefully cover most cases. They are WC_Payment_Gateway_CC (for credit card based tokens) and WC_Payment_Gateway_eCheck (for eCheck based tokens). These classes were introduced along with the Token API in 2.6. WooCommerce ships with two base classes for gateways. Step 0: Extending The Correct Gateway Base We'll use the Simplify Commerce gateway in some of these examples. Tutorials Adding Payment Token API Support To Your Gateway This guide offers a few useful tutorials for using the new API as well as all the various methods available to you. Users can also manage these tokens from their account settings and choose from saved payment tokens on checkout. WooCommerce 2.6 introduced an API for storing and managing payment tokens for gateways. set_users_default( $user_id, $token_id ).get_customer_default_token( $customer_id ).get_customer_tokens( $customer_id, $gateway_id = '' ).Step 2: Provide get_ And set_ Methods For Extra Data.Step 0: Extend WC_Payment_Token And Name Your Type.Step 4: Retrieve The Token When Processing Payments.Step 2: Define A Method For Adding/Saving New Payment Methods From "My Account".Step 0: Extending The Correct Gateway Base.Adding Payment Token API Support To Your Gateway.Template File Guidelines for Devs and Theme Authors.Enabling product gallery features (zoom, swipe, lightbox).2.6.x to 3.0.0 Developer Migration Notes.Writing high-quality testing instructions.CSS SASS coding guidelines and naming conventions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |