import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'angualr-stripe-payment-app';
paymentHandler:any = null;
ngOnInit() {
this.invokeStripe();
}
initializePayment(amount: number) {
const paymentHandler = (<any>window).StripeCheckout.configure({
key: 'pk_test_51LNufQSCtP1jbuyeViX8JQDKe2RViL55QgmABDrd30hZaGT678W2hYjmoxUqwMFqQjyJf84IoBsk1gxocY74Jbbp00wcDmkroy',
locale: 'auto',
token: function (stripeToken: any) {
console.log({stripeToken})
alert('Stripe token generated!');
}
});
paymentHandler.open({
name: 'Aashu Kumar Jha',
description: 'Buying a Hot Coffee',
amount: amount * 100
});
}
invokeStripe() {
if(!window.document.getElementById('stripe-script')) {
const script = window.document.createElement("script");
script.id = "stripe-script";
script.type = "text/javascript";
script.src = "https://checkout.stripe.com/checkout.js";
script.onload = () => {
this.paymentHandler = (<any>window).StripeCheckout.configure({
key: 'pk_test_sLUqHXtqXOkwSdPosC8ZikQ800snMatYMb',
locale: 'auto',
token: function (stripeToken: any) {
console.log(stripeToken)
alert('Payment has been successfull!');
}
});
}
window.document.body.appendChild(script);
}
}
}使用这个代码我要用借记卡来实现支付集成系统,我想把UPI支付系统集成成一个角度,我想把upi支付系统划分成一个角度,任何一个人可以共享这些代码并提供帮助吗?
发布于 2022-08-29 07:31:27
您似乎使用了遗留的Stripe集成(checkout.js),这不支持UPI。
今天,对于任何支付方法,您都需要Stripe的最新集成,要么是Checkout (从服务器端重定向),要么是stripe.js (客户端的直接集成)。
具体来说,对于UPI,您需要向Stripe提供详细的支持
https://stackoverflow.com/questions/73525198
复制相似问题