5

iPhone アプリで、選択したカート項目を Paypal サンドボックス テスト アカウントでチェックアウトすると、「このトランザクションを続行するための PayPal トークンが受信されていません」というエラーが表示されました。エラーがサーバー側にあったのかアプリ側にあったのか、誰でも明確にできますか? 私のコードは ---

- ( IBAction ) btnPaybyClicked:( id ) sender {
    HUD = [[MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES] retain];
    HUD.labelText = NSLocalizedString(@"hud_redirecting_to_paypal", @"");
    JBMLog(@"strPaypalDevicetoken %@", _strPaypalDevicetoken);

//    NSLog(@"strPaypalDevicetoken %@", _strPaypalDevicetoken);

    //NSURL *url = [NSURL URLWithString:PAYPAL_URL];
    NSURL *url = [NSURL URLWithString:PAYPAL_AIW_URL];
    NSLog(@"URLlll = %@",url);
    User *currentUserObj = [UserDefaults getUserProfile];

    float deliveryCharge = 0.0;

    _asiFormRequest = [ASIFormDataRequest requestWithURL:url];
    [_asiFormRequest addRequestHeader:@"Content-Type" value:@"application/x-www-form-urlencoded"];
    [_asiFormRequest setPostValue:[sender tag] == 0 ? PAYPAL_PAYWITH_PAYPAL: PAYPAL_PAYWITH_CREDITCARD forKey:@"landingPage"];
    [_asiFormRequest setPostValue:[NSNumber numberWithInt:currentUserObj.userId] forKey:@"userid"];
    [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%@ %@", currentUserObj.firstName, currentUserObj.lastName] forKey:@"custName"];
    [_asiFormRequest setPostValue:currentUserObj.address forKey:@"custAdress"];
    [_asiFormRequest setPostValue:currentUserObj.suburb forKey:@"custSuberb"];
    [_asiFormRequest setPostValue:currentUserObj.postalcode forKey:@"custPostCode"];
    [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%.2f", deliveryCharge] forKey:@"DeliveryCharge"];

    [_asiFormRequest setPostValue:currentUserObj.phone forKey:@"custPhone"];
    [_asiFormRequest setPostValue:currentUserObj.email forKey:@"custEmail"];


    NSMutableArray *mArCart = [[DBModel database] shoppingList];


    int i = 0;
    float totalAmount = 0.0;
    for (Product *productObj in mArCart) {
        [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%d",productObj.productId] forKey:[NSString stringWithFormat:@"productArray[%d][productId]", i]];

        [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%d",productObj.selectedColorId] forKey:[NSString stringWithFormat:@"productArray[%d][colorId]", i]];

        [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%d",productObj.selectedSizeId] forKey:[NSString stringWithFormat:@"productArray[%d][sizeId]", i]];

        [_asiFormRequest setPostValue:productObj.productName forKey:[NSString stringWithFormat:@"productArray[%d][name]", i]];

        [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%.2f", productObj.selectedPrice] forKey:[NSString stringWithFormat:@"productArray[%d][price]", i]];


        [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%d", productObj.selectedQuantity] forKey:[NSString stringWithFormat:@"productArray[%d][qty]", i]];

        i++;
        totalAmount += productObj.selectedPrice*productObj.selectedQuantity;
    }
    [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%.2f",totalAmount+deliveryCharge] forKey:@"amount"];

    [_asiFormRequest setPostValue:[NSString stringWithFormat:@"%.2f",totalAmount] forKey:@"ItemTotal"];

    NSURL *url1 = [NSURL URLWithString:[NSString stringWithFormat:@"%@?token=%@", PAYPAL_AIW_URL, _payPalToken]];
    NSLog(@"uuu%@",url1);

    paymentTotal = totalAmount+deliveryCharge;
    [_asiFormRequest setDelegate:self];
    [_asiFormRequest setTimeOutSeconds:REQEST_TIMEOUT];

    [_asiFormRequest setDidFinishSelector:@selector(finishedPayPalFirstCallReqest:)];  
    [_asiFormRequest setDidFailSelector:@selector(failedPayPalFirstCallReqest:)];
    [_asiFormRequest startAsynchronous];
}
4

0 に答える 0