Skip to content

Conversation

@Jamesking56
Copy link
Contributor

Helps when doing custom things on a site

@duncanmcclean
Copy link
Owner

How are you calling charge in your code?

@Jamesking56
Copy link
Contributor Author

How are you calling charge in your code?

Currently having to do this:

if (
    null !== $order->paymentGateway()
    && ($order->status() === OrderStatus::PaymentReceived || $order->status() === OrderStatus::Shipped)
) {
    try {
        // Grab the payment method details from Stripe
        $charge = \Stripe\Charge::retrieve(\Stripe\PaymentIntent::retrieve($order->get('stripe_payment_intent'))->latest_charge);
        $receipt = $charge->receipt_url;
        $paymentMethod = match($charge->payment_method_details->type) {

@duncanmcclean
Copy link
Owner

I don't love the idea of exposing driver-specific methods like this.

Charges are specific to Stripe. Mollie calls them "payments". Other gateways might call them different things. Also, people might expect they can do ->paymentIntent() to get the payment intent object.

I may change my mind in the future, but for now, I recommend doing what you're already doing (getting the payment intent ID from the order data and getting the charge that way).

Sorry! 😬

@Jamesking56 Jamesking56 deleted the patch-1 branch December 8, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants