5

I am using WooCoommerce with WooCommerce Subscription plugin and Stripe. The subscription is being charged monthly and products are being sent out to the customer, the customer then decides wether to keep and pay for the items or return them.

If they don't return or pay for the items then the system needs to be able to charge the full amount to the Stripe payment card stored in the subscription, a custom plugin will be written to handle this automatically.

The sticking point is being able to charge the card stored via Stripe.

What is the best way to approach this?

I have been searching through the docs and can't seem to find a suitable hook so looking for some advice on the best way to approach this.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
AppleTattooGuy
  • 1,145
  • 8
  • 17
  • 39

1 Answers1

0

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

Cheech
  • 355
  • 3
  • 16