/// <remarks/> public void GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq GetExpressCheckoutDetailsReq, object userState) { if ((this.GetExpressCheckoutDetailsOperationCompleted == null)) { this.GetExpressCheckoutDetailsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExpressCheckoutDetailsOperationCompleted); } this.InvokeAsync("GetExpressCheckoutDetails", new object[] { GetExpressCheckoutDetailsReq}, this.GetExpressCheckoutDetailsOperationCompleted, userState); }
private IPaymentResponse EndExpressCheckout(IPaymentRequest request) { PaymentResponse response = new PaymentResponse (); GetExpressCheckoutDetailsReq req = new GetExpressCheckoutDetailsReq() { GetExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType() { Version = this._paymentGateway.APIVersion, Token = request.Token, } }; // query PayPal for transaction details GetExpressCheckoutDetailsResponseType paypalResp = BuildPayPalWebservice().GetExpressCheckoutDetails(req); //handle error if (paypalResp.Errors != null && paypalResp.Errors.Length > 0) { response.IsSuccess = false; response.Message = paypalResp.Errors[0].LongMessage; return response; } GetExpressCheckoutDetailsResponseDetailsType respDetails = paypalResp.GetExpressCheckoutDetailsResponseDetails; PaymentDetailsType[] sPaymentDetails = new PaymentDetailsType[1]; sPaymentDetails[0] = new PaymentDetailsType() { OrderTotal = new BasicAmountType() { currencyID = respDetails.PaymentDetails.FirstOrDefault().OrderTotal.currencyID, Value = respDetails.PaymentDetails.FirstOrDefault().OrderTotal.Value }, /*must specify PaymentAction and PaymentActionSpecific, or it'll fail with PaymentAction : Required parameter missing (error code: 81115)*/ PaymentAction = PaymentActionCodeType.Sale, // Recurring = RecurringFlagType.Y, PaymentActionSpecified = true }; // prepare for commiting transaction DoExpressCheckoutPaymentReq payReq = new DoExpressCheckoutPaymentReq() { DoExpressCheckoutPaymentRequest = new DoExpressCheckoutPaymentRequestType() { Version = this._paymentGateway.APIVersion, DoExpressCheckoutPaymentRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType() { Token = paypalResp.GetExpressCheckoutDetailsResponseDetails.Token, /*must specify PaymentAction and PaymentActionSpecific, or it'll fail with PaymentAction : Required parameter missing (error code: 81115)*/ PaymentAction = PaymentActionCodeType.Sale, PaymentActionSpecified = true, PayerID = paypalResp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID, PaymentDetails = sPaymentDetails } } }; // commit transaction and display results to user DoExpressCheckoutPaymentResponseType doResponse = BuildPayPalWebservice().DoExpressCheckoutPayment(payReq); try { //handle error if (paypalResp.Errors != null && paypalResp.Errors.Length > 0) { response.IsSuccess = false; response.Message = paypalResp.Errors[0].LongMessage; return response; } } catch (Exception ex) { } if (!string.IsNullOrEmpty(doResponse.DoExpressCheckoutPaymentResponseDetails.PaymentInfo[0].TransactionID) && doResponse.Ack == AckCodeType.Success) { response.TransactionId = doResponse.DoExpressCheckoutPaymentResponseDetails.PaymentInfo[0].TransactionID; } else { response.IsSuccess = false; response.Message = "No Transaction id returned"; return response; } // Create Recurring profile. var pp_response = CreateRecurringPaymentsProfile(paypalResp.GetExpressCheckoutDetailsResponseDetails.Token, respDetails.PaymentDetails.FirstOrDefault().OrderTotal, respDetails.PaymentDetails[0], request); string profileId = pp_response.CreateRecurringPaymentsProfileResponseDetails.ProfileID; return null; }
/// <remarks/> public void GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq GetExpressCheckoutDetailsReq) { this.GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq, null); }