I'm using the Braintree GraphQL API and Drop-In UI for Javascript. We're offering the following payment methods:
How can I extract an enum value representing these payment methods from a Transaction?
The Transaction
Object contains the field paymentMethodSnapshot, which can be queried:
query { node(id: "TRANSACTION_GLOBAL_ID"){
... on Transaction {
paymentMethodSnapshot {
__typename
... on CreditCardDetails {
origin {
type
}
}
}
}
}
}
The different payment methods can be distinguished by evaluating the __typename
To detect Google and Apple Pay Payments you can query the origin.type
field on CreditCardDetails
, that contains additional information if the credit card was provided from a third-party origin, such as Apple Pay, Google Pay, or another digital wallets.