gpt4 book ai didi

ios - iOS 中的 Paypal 集成第一次不显示登录窗口?

转载 作者:太空宇宙 更新时间:2023-11-03 16:33:14 25 4
gpt4 key购买 nike

我想在我的项目中实现 Paypal 支付网关,但在连续执行 3 次或更多次以下 IBAction 后显示 paypal 登录窗口请告诉我以下代码有什么问题

-(IBAction)initializePaypal:(id)sender
{
[PayPal initializeWithAppID:@"APP-80W284485P519543T"forEnvironment:ENV_SANDBOX];
status = PAYMENTSTATUS_CANCELED;
[PayPal getPayPalInst].shippingEnabled = FALSE;
[PayPal getPayPalInst].dynamicAmountUpdateEnabled = FALSE;

//for a payment with a single recipient, use a PayPalPayment object

payment = [[PayPalPayment alloc] init] ;
payment.recipient = payPalValue.merchantEmail;
payment.paymentCurrency = payPalValue.currencyCode;
payment.description = payPalValue.itemName;
payment.merchantName = @"By Post";
payment.subTotal = payPalValue.amount;

[[PayPal getPayPalInst] checkoutWithPayment:payment];

}

最佳答案

单击按钮时,您正在调用 paypal 初始化。需要 3-4 秒。您在此之前调用了初始化并检查了 initializationStatus,然后再次调用,如下面的代码所示

-(IBAction)initializePaypal:(id)sender
{
if ([PayPal initializationStatus] == STATUS_COMPLETED_SUCCESS)
{
status = PAYMENTSTATUS_CANCELED;
[PayPal getPayPalInst].shippingEnabled = FALSE;
[PayPal getPayPalInst].dynamicAmountUpdateEnabled = FALSE;

//for a payment with a single recipient, use a PayPalPayment object

payment = [[PayPalPayment alloc] init] ;
payment.recipient = payPalValue.merchantEmail;
payment.paymentCurrency = payPalValue.currencyCode;
payment.description = payPalValue.itemName;
payment.merchantName = @"By Post";
payment.subTotal = payPalValue.amount;

[[PayPal getPayPalInst] checkoutWithPayment:payment];
}
else
{
NSLog(@"initialization failed");// show alert or "reintialising paypal"
}
}

关于ios - iOS 中的 Paypal 集成第一次不显示登录窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19786475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com