Skip to content

Commit 3c3b4ac

Browse files
authored
DEVDOCS-4211 - eWallet buttons in GraphQL API
1 parent 8c1273b commit 3c3b4ac

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# eWallet Buttons with the GraphQL Storefront API
2+
3+
BigCommerce's GraphQL Storefront API allows you to query and initialize eWallet payment buttons (Apple Pay, Google Pay, PayPal, etc.) for use in both regular and headless storefronts. This enables merchants and system integrators to provide seamless wallet payment experiences across the shopper journey.
4+
5+
<Callout type="warning">
6+
Wallet initialization data and client tokens are returned and may be sensitive. Ensure all data is handled securely and any user-facing content is sanitized or validated to prevent security vulnerabilities.
7+
</Callout>
8+
9+
## Example Usage
10+
11+
Use the `paymentWalletWithInitializationData` query to fetch initialization data and client tokens for a specific wallet and cart. You may also use the `createPaymentWalletIntent` mutation to initialize payment intents for supported wallets.
12+
13+
<Tabs items={['Query: Initialization Data', 'Mutation: Create Intent', 'Response']}>
14+
<Tab>
15+
16+
```graphql filename="Example query: Get wallet initialization data" showLineNumbers copy
17+
query GetWalletInitData($cartId: String!, $walletEntityId: String!) {
18+
paymentWalletWithInitializationData(
19+
filter: {
20+
cartEntityId: $cartId,
21+
paymentWalletEntityId: $walletEntityId
22+
}
23+
) {
24+
initializationData
25+
clientToken
26+
}
27+
}
28+
```
29+
30+
</Tab>
31+
<Tab>
32+
33+
```graphql filename="Example mutation: Create a payment wallet intent" showLineNumbers copy
34+
mutation CreateWalletIntent($cartId: String!, $walletEntityId: String!) {
35+
payment {
36+
paymentWallet {
37+
createPaymentWalletIntent(
38+
input: {
39+
cartEntityId: $cartId,
40+
paymentWalletEntityId: $walletEntityId
41+
}
42+
) {
43+
errors {
44+
message
45+
}
46+
paymentWalletIntentData {
47+
approvalUrl
48+
orderId
49+
initializationEntityId
50+
}
51+
}
52+
}
53+
}
54+
}
55+
```
56+
57+
</Tab>
58+
<Tab>
59+
60+
```json filename="Example response: Wallet initialization and intent" showLineNumbers copy
61+
{
62+
"data": {
63+
"paymentWalletWithInitializationData": {
64+
"initializationData": "InitializationDataForApplePay",
65+
"clientToken": "ClientTokenForApplePay"
66+
},
67+
"payment": {
68+
"paymentWallet": {
69+
"createPaymentWalletIntent": {
70+
"errors": [],
71+
"paymentWalletIntentData": {
72+
"approvalUrl": "https://provider.com/approve",
73+
"orderId": "ORDER123",
74+
"initializationEntityId": "ENTITY456"
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}
81+
```
82+
83+
</Tab>
84+
</Tabs>
85+
86+
## Key Points
87+
88+
- **Secure Handling**: Initialization data and client tokens are sensitive. Store and transmit securely.
89+
- **Supported Wallets**: Examples include Apple Pay, Google Pay, PayPal, Venmo, Worldpay, etc.
90+
- **Dynamic Context**: Both queries and mutations require a valid cart ID and wallet entity ID, allowing dynamic integration for headless storefronts.
91+
- **Feature Flags**: These APIs may be gated by feature flags and are in alpha; check production readiness before use.
92+
- **Deprecation Notices**: Some fields are marked as alpha or deprecated; consult API documentation for stability.
93+
94+
## Additional Resources
95+
- [GraphQL Storefront API Reference](/graphql-storefront/reference#group-Operations-Queries)
96+
- [GraphQL Storefront API overview](/docs/storefront/graphql)
97+
- [Best Practices for Using GraphQL APIs](/docs/storefront/graphql/best-practices)

0 commit comments

Comments
 (0)