#FallenBlade

1 messages · Page 1 of 1 (latest)

lusty waveBOT
hidden summit
#

Is this in a 3rd party connector/plugin? Or did you code the Stripe Element yourself?

inner lake
#

I code the Stripe Element by myself

hidden summit
#

I think you need to set setup_future_usage: "off_session" on the Payment Intent

inner lake
#

How do you do that in invoice? I am using Invoice.

    // Create an Invoice
    $invoice = $this->stripe->invoices->create([
      'customer' => $customer->id,
    ]);

    // Create an Invoice Item with the Price, and Customer you want to charge
    $this->stripe->invoiceItems->create([
      'customer' => $customer->id,
      'price' => Constants::STRIPE_PRICES_ID['ONE_REPORT'],
      'invoice' => $invoice->id,
    ]);

    //Finalized the Invoice
    $finalizeInvoice = $this->stripe->invoices->finalizeInvoice(
      $invoice->id,
      [
        'expand' => ['payment_intent'],
      ]
    );
hidden summit
#

You would need to get the Payment Intent from the Invoice here: https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent

Then you could set setup_future_usage on the Payment Intent using this Payment Intent update API call: https://stripe.com/docs/api/payment_intents/update#update_payment_intent-setup_future_usage

inner lake
#

Thanks! It works now!

#

Thank you so much two-shoes!

hidden summit
#

Sure thing!