App reviews, troubleshooting, and recommendations
Via the Order Admin REST API or GraphQL API, is it possible to see the payment method for a given order regardless of the payment gateway?
I’m trying to detect if a given order was paid with a credit card, and ignore all other payment method types, like cash, check, ACH, etc.
Want to see it in action? Check out our demo store.
Hi
I see the transaction resource returns the credit card company https://shopify.dev/api/admin-rest/2022-10/resources/transaction#resource-object
What I have not tested here is what is returned if it is credit card but a different "method" such as payment terms via Shopify Payments.
Thanks @shuleGoing , this was my go to method for about a year, but now the order REST resource no longer includes payment details as of `2023-04` which is the new minimum Shopify Admin API version.
I'm reviewing the order transactions but there doesn't seem to be an equivalent field to detect credit card payments:
https://shopify.dev/docs/api/admin-graphql/2023-04/objects/OrderTransaction
Want to see it in action? Check out our demo store.
I believe I've found a solution.
The `PaymentDetails` on an `OrderTransaction` does provide a `company` field.
This might be the equivalent of the old REST `order.payment_details.company_name`, at least I'm hoping so.
I can see that an order paid with the Bogus Gateway will have this path filled, but unfortunately it looks like Development Stores no longer Cash on Delivery (COD) as a valid payment, so I can't test further.
But for anyone else finding this thread, here's the query I'm trying to detect a credit card payment with:
```
```
The hope is that testing for the presence of the `company` field like with `order.transactions.some(txn => txn.paymentDetails?.company)` will detect a credit card payment instead of a cash, PayPal, etc payment.
Want to see it in action? Check out our demo store.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024