Open
Description
this is my code
card_token always undefined
what should i do to get back the paymentToken
showPaymentSheet = (succeed = true) => {
const {amount} = this.props;
const newStr = amount.replace(/,/, '');
console.log('Here is amount', amount, newStr);
const paymentRequest = new PaymentRequest(
[
{
supportedMethods: ['apple-pay'],
data: {
merchantIdentifier: '****',
//supportedNetworks: ['visa', 'mastercard', 'mada'],
supportedNetworks: ['mada'],
countryCode: 'SA',
currencyCode: 'SAR',
// // uncomment this block to activate automatic Stripe tokenization.
// // try putting your key pk_test... in here and see how the token format changes.
// paymentMethodTokenizationParameters: {
// parameters: {
// gateway: 'stripe',
// 'stripe:publishableKey': Config.STRIPE_KEY,
// },
// },
},
},
],
{
id: 'basic-example',
displayItems: [
{
label: 'Deposit',
amount: {currency: 'SAR', value: newStr},
},
],
total: {
label: `${strings('global.appName')} ${strings('title.wallet')}`,
amount: {currency: 'SAR', value: newStr},
},
},
);
paymentRequest
.show()
.then((paymentResponse) => {
console.log('paymentResponse', paymentResponse.details)
const card_token = paymentResponse.details.paymentToken;
if (succeed) {
paymentResponse.complete('success');
this.apiPostApplePay();
showToast(`Payment request completed with card token ${card_token}`);
} else {
paymentResponse.complete('failure');
showDangerToast('Payment request failed');
}
})
.catch((error) => {
console.log('error', error);
if (error.message === 'AbortError') {
showDangerToast('Payment request was dismissed');
// this.debug('Payment request was dismissed');
}
});
};
Metadata
Metadata
Assignees
Labels
No labels