cordova - 离子贝宝ID交易
问题描述
早上好,我正在研究很多,但我仍然没有得到我想要的,我对这一切都很陌生。我想知道通过 PayPal 付款时如何获取交易 ID。我在https://ionicframework.com/docs/native/paypal/上没有找到任何东西, 有人可以帮我解决付款后如何获取交易 ID 吗?我的想法是在付款后根据交易数据生成一个二维码。先感谢您!
这是我的代码:
this.payPal.init({
PayPalEnvironmentProduction: ''
PayPalEnvironmentSandbox: 'mySandbox',
}).then(() => {
this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
acceptCreditCards: false,
languageOrLocale: 'pt-BR',
merchantName: (this.produto.nom_produto),
merchantPrivacyPolicyURL: '',
merchantUserAgreementURL: ''
})).then(() => {
let detail = new PayPalPaymentDetails('1.00', '0.00', '0.00');
let payment = new PayPalPayment('1.00', 'BRL', 'Produto', 'Sale', detail);
this.payPal.renderSinglePaymentUI(payment).then((response) => {
console.log('pagamento efetuado');
this.createCode();
let toast = this.toastCtrl.create({ duration: 3000, position: 'bottom' });
toast.setMessage('Pagamento efetuado com sucesso');
toast.present();
}, () => {
console.log('erro ao renderizar o pagamento do paypal');
})
})
})
}
解决方案
支付成功。您可以在下面找到交易的 id
this.payPal.init({
PayPalEnvironmentProduction: ''
PayPalEnvironmentSandbox: 'mySandbox',
}).then(() => {
this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
acceptCreditCards: false,
languageOrLocale: 'pt-BR',
merchantName: (this.produto.nom_produto),
merchantPrivacyPolicyURL: '',
merchantUserAgreementURL: ''
})).then(() => {
let detail = new PayPalPaymentDetails('1.00', '0.00', '0.00');
let payment = new PayPalPayment('1.00', 'BRL', 'Produto', 'Sale', detail);
this.payPal.renderSinglePaymentUI(payment).then((response) => {
console.log('pagamento efetuado');
let transactionId = response.response.id;
console.log('Your transaction id is ', transactionId);
this.createCode();
let toast = this.toastCtrl.create({ duration: 3000, position: 'bottom' });
toast.setMessage('Pagamento efetuado com sucesso');
toast.present();
}, () => {
console.log('erro ao renderizar o pagamento do paypal');
});
});
});
推荐阅读
- parsing - 如何使用 megaparsec 报告多个错误?
- sqlite - 如何使用 lua 固件在 ESP8266 上运行 sqlite3?
- python - 使用 MDM 从 iOS 设备安装或删除应用程序时,我可以收到通知或任何观察者吗?
- celery - 如何知道 Celery 的所有任务都完成了?
- java - 如何使用 Android 在 Firebase 实时数据库中检索经过身份验证的用户的用户数据
- windows - PM2离线安装在Window Server上?
- javascript - $(document).ready() 内的 div 高度为零
- html - htaccess rewrite - 如何将域重定向到域
- python - 不使用 remove 或 fromkeys 删除重复项;列表切片;Python
- mysql - MYSQL Workbench 安装 - 架构未连接