Support » Plugin: WooCommerce Stripe Payment Gateway » Apple Pay Stats on Stripe

  • Resolved topraf

    (@topraf)


    Hey, i’ve successfully integrated Apple Pay & google pay via the plugin, but i can’t manage to get any stats on their usage as they’re still “Credit Card” payment methods. Guys at Stripe told me some metadata could be attached to the transaction to tell if it was done via Google Pay / Apple Pay.
    has anyone found a way to tell which payment method is used?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey there @topraf

    When a payment is made via a Payment Request button, that information will show on the order.

    Such as:

    Chrome Payment Request (Stripe)

    Can you let me know what stats you are looking for, please?

    Thanks,

    Hi Doug, thanks. I was wondering if this info could be sent to Stripe as to appear in their dashboard too.

    Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey @topraf

    One of the following filter hooks should help:

    wc_stripe_payment_metadata ($metadata, $order, $prepared_source) – Metadata that gets passed during a payment request.

    As this is a development topic and I don’t have a full solution I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    Thanks,

    Plugin Support dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @topraf

    I come back with a small gift, add this to the functions.php file of your child theme:

    `
    function _add_payment_method_to_stripe_metadata( $metadata, $order, $prepared_source ) {
    $metadata[‘payment_method_type’] = $order->get_payment_method_title();
    return $metadata;
    }
    add_filter( ‘wc_stripe_payment_metadata’, ‘_add_payment_method_to_stripe_metadata’, 10, 3 );
    `

    Now, when an order is made, you can search https://dashboard.stripe.com/payments for “Chrome” or “Apple” and it will return anything paid via that method as the search bar will search the metadata fields (as it currently will if you search for an order ID).

    Usual disclaimer that this snippet is provided “as-is” and I cannot accept anything that happens when you use it.

    If this works for you, please do mark this thread as Resolved.

    Thanks,

    @dougaitken thanks a lot!! i’ve added it to my functions and now i’ll wait for some customers to use this payment method and see if it pops up. thanks again

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.