【发布时间】:2014-04-15 06:17:24
【问题描述】:
我在 appdelegate 中使用以下代码
[PayPalMobile initializeWithClientIdsForEnvironments:@{PayPalEnvironmentProduction : @"some client id"}];
并使用此代码进行 paypalpayment
#define kPayPalEnvironment PayPalEnvironmentProduction
- (void)viewDidLoad
{
[super viewDidLoad];
// Set up payPalConfig
_payPalConfig = [[PayPalConfiguration alloc] init];
_payPalConfig.acceptCreditCards = YES;
_payPalConfig.languageOrLocale = @"en";
_payPalConfig.merchantName = @"Anything";
_payPalConfig.languageOrLocale = [NSLocale preferredLanguages][0];
// Do any additional setup after loading the view, typically from a nib.
// use default environment, should be Production in real life
self.environment = kPayPalEnvironment;
NSLog(@"PayPal iOS SDK version: %@", [PayPalMobile libraryVersion]);
}
- (IBAction)btnPaypalClicked:(UIButton *)sender
{
PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = [[NSDecimalNumber alloc] initWithString:@"5"];
payment.currencyCode = @"GBP";
payment.shortDescription = @"anything";
if (!payment.processable) {
// This particular payment will always be processable. If, for
// example, the amount was negative or the shortDescription was
// empty, this payment wouldn't be processable, and you'd want
// to handle that here.
}
// Update payPalConfig re accepting credit cards.
self.payPalConfig.acceptCreditCards = self.acceptCreditCards;
PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
configuration:self.payPalConfig
delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
}
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment
{
NSLog(@"PayPal Payment Success!");
NSLog(@"%@",completedPayment);
[self saveCompletedPayment:completedPayment]; // Payment was processed successfully; send to server for verification and fulfillment
[self dismissViewControllerAnimated:YES completion:nil];
}
我正在使用上述所有代码进行贝宝付款。 但是当我付款时显示以下错误
TRANSACTION_REFUSED - 交易被拒绝。
我的 paypal 帐户中有余额,但仍然出现此错误。
我还缺少什么吗?
请帮我解决这个问题。
提前致谢。
【问题讨论】: