Post

Replies

Boosts

Views

Activity

Reply to Not able to make payment to apple using test cards.
{ supportedMethods: ['apple-pay'], data: { merchantIdentifier: 'merchantID', supportedNetworks: ['visa', 'mastercard', 'amex'], countryCode: 'US', currencyCode: 'USD', }, }, ]; const DETAILS = { id: 'basic-example', displayItems: [ { label: 'Movie Ticket', amount: {currency: 'USD', value: '15.00'}, }, { label: 'Grocery', amount: {currency: 'USD', value: '5.00'}, }, ], shippingOptions: [ { id: 'economy', label: 'Economy Shipping', amount: {currency: 'USD', value: '0.00'}, detail: 'Arrives in 3-5 days', // `detail` is specific to React Native Payments }, ], total: { label: 'Enappd Store', amount: {currency: 'USD', value: '20.00'}, }, }; const OPTIONS = { requestPayerName: true, requestPayerPhone: true, requestPayerEmail: true, requestShipping: true, }; const paymentRequest = new PaymentRequest(METHOD_DATA, DETAILS, OPTIONS); paymentRequest.addEventListener('shippingaddresschange', e => { const updatedDetails = getUpdatedDetailsForShippingAddress( paymentRequest.shippingAddress, ); e.updateWith(updatedDetails); }); paymentRequest.addEventListener('shippingoptionchange', e => { const updatedDetails = getUpdatedDetailsForShippingOption( paymentRequest.shippingOption, ); e.updateWith(updatedDetails); }); check = () => { paymentRequest.canMakePayments().then(canMakePayment => { if (canMakePayment) { Alert.alert('Apple Pay', 'Apple Pay is available in this device'); } }); }; pay = () => { paymentRequest.canMakePayments().then(canMakePayment => { if (canMakePayment) { console.log('Can Make Payment'); paymentRequest.show().then(paymentResponse => { // Your payment processing code goes here paymentResponse.complete('success'); }); } else { console.log('Cant Make Payment'); } }); };
Jul ’24