Skip to content

Commit

Permalink
docs: add usage of base64 encoding function to apple pay demo readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ehrdi committed Aug 6, 2024
1 parent 39e90c2 commit 336542a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions applepay-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const applePayButton: ApplePayButton = {
```typescript
import {
ApplePayButton,
encodeToBase64,
PCPApplePaySession,
PCPApplePaySessionConfig,
} from 'pcp-client-javascript-sdk';
Expand Down Expand Up @@ -169,9 +170,8 @@ const init = async () => {
],
validateMerchantURL: import.meta.env.VITE_APPLE_PAY_VALIDATE_MERCHANT_URL,
processPaymentURL: import.meta.env.VITE_APPLE_PAY_PROCESS_PAYMENT_URL,
applicationData: {
foo: 'bar',
},
// This data is completely custom and can be sent to your server for merchant validation and must be used as a base64 encoded string here for the apple pay server (see: https://developer.apple.com/documentation/apple_pay_on_the_web/applepayrequest/2951834-applicationdata)
applicationData: encodeToBase64(JSON.stringify({ foo: 'bar' })),
paymentMethodSelectedCallback: async (paymentMethod) => {
console.log('paymentMethodSelectedCallback', paymentMethod);
return {
Expand Down

0 comments on commit 336542a

Please sign in to comment.