Charge saved Stripe card programmatically in WooCommerce Charge saved Stripe card programmatically in WooCommerce wordpress wordpress

Charge saved Stripe card programmatically in WooCommerce


The only way I have figured out how to programmatically create a payment is to use the stripe api to charge the saved customer that woo stripe has created. Once you have successfully created the charge you then need to set all the necessary post meta.

//Set all the meta data that will be needed$order->update_meta_data( '_stripe_source_id', $charge->payment_method );$order->update_meta_data( '_stripe_charge_captured', 'yes'  );$order->update_meta_data( '_stripe_currency', $charge->currancy);$order->update_meta_data( '_stripe_customer_id', $charge->customer);

There is a more detailed answer over here


You have to write a custom code / plugin and run using cron every day or every 12 hours.

  1. if you save card details to the stripe then save that card_id (card_XXXXXXXXXX2CaGDZLJ48) to the local database with user_id and product_id.
  2. then have to check how many user doesn't pay or return iteam.
  3. Now charge those user ( with that stripe card_XXXXXXXX ) who don't pay or return item.
  4. send notification to user.