Hi @believelody,
You will find most of the information you need by reviewing our API docs where all of the code is documented.
API Docs
The class you should look at is WC_Stripe_Controller_Checkout. The route is wp-json/wc-stripe/v1/checkout and it follows the WP semantics for REST url’s. The process_checkout method acts as a wrapper for the WC_Checkout::process_checkout method.
If you look here you will see that all payment methods are submitted to the server in the format ${gateway_id}_token_key so stripe_cc_token_key for the credit card gateway.
All other fields like billing and shipping info is submitted in the format that WC expects.
Kind Regards,
Hello, thank you very much for all this information. I will give it a try.
Just another question about the format. Does that mean that those following properties: save_method_key, save_source_key, payment_type_key and payment_intent_key in WC_Payment_Gateway_Stripe will begin by “gateway_id” which is “stripe_cc” ? I read in stripe docs that it needs a source or a token or a payment_method id string from client side. I’m a bit confuse in this part.
Sincerelly
Hi @believelody,
Yes all of those properties begin with the gateway’s ID.
When submitting the Stripe payment method to your server, it should be in the format ${gateway_id}_token_key. So for the credit card gateway it would be stripe_cc_token_key.
Here is what each property is used for:
$token_key: Used for the one time payment
$saved_method_key: Used when a customer pays with a saved payment method
$save_source_key: Indicator that is set when customer want’s to save their payment method
$payment_type_key: Indicator that tells the plugin if the customer is paying with a new or saved payment method.
Kind Regards,
Hi @mrclayton, thank you very much, I will go with that.
Kind Regards