lundi 28 octobre 2019

Testing Stripe - Creating charge for Checkout session

I'm using Stripe checkout and I have it all working as follows:

Create Session, redirect to Checkout, handle order fulfillment on redirect with passed through session_id.

I'm trying to write a test for this but I can't figure out how to fake a Stripe Checkout charge onto the Stripe Session & PaymentIntent.

I'm using the PHP Library and I've tried this:

$paymentIntent = PaymentIntent::retrieve($session->payment_intent);

dd($paymentIntent->charges->create([
    'source' => 'tok_visa_debit',
    'currency' => 'gbp',
    'amount' => 100,
]));

But I am getting an error: Stripe\Error\InvalidRequest : Received unknown parameter: payment_intent

What is the correct way to test this works?

Aucun commentaire:

Enregistrer un commentaire