0

大家好,我遇到了贝​​宝代表的问题-

(void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus {

事务成功并结束时永远不会调用。这是我的代码

- (void)viewDidLoad
{
    [super viewDidLoad];

    [PayPal initializeWithAppID:kPayPalAPI
                 forEnvironment:ENV_SANDBOX];
    // Do any additional setup after loading the view from its nib.
}


-(IBAction)payWithPayPal{

    PayPalPayment *payment = [[[PayPalPayment alloc] init] autorelease];
    payment.recipient = @"xxxx@mail.com";
    payment.paymentCurrency = @"EUR";
    payment.description =[NSString stringWithFormat:@"test tetst %@",stest];
    payment.merchantName = @"Test product";

    //subtotal of all items, without tax and shipping
    payment.subTotal = [NSDecimalNumber decimalNumberWithString:txtMontant.text];

    PayPalInvoiceItem *item = [[[PayPalInvoiceItem alloc] init] autorelease];
    item.totalPrice = payment.subTotal;
    item.name = @"Test";
    [payment.invoiceData.invoiceItems addObject:item];

    [[PayPal getPayPalInst] checkoutWithPayment:payment];

}

我已经这样设置了代表ViewController : UIViewController<UITextFieldDelegate,PayPalPaymentDelegate>。我有什么遗漏吗?

4

1 回答 1

0

如果你想得到paykey

使用这种方法:

(void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus 

使用您自己的自定义按钮。试试下面的代码:

 _your_custom_button = [[PayPal getPayPalInst]getPayButtonWithTarget:self
                       andAction:@selector(paywithpaypal)
                       andButtonType:BUTTON_278x43
                       andButtonText:BUTTON_TEXT_PAY];

并按方式付款paywithpaypal

于 2015-05-20T07:42:06.377 回答