protected void finishTransactionButton_Click(object sender, EventArgs e)
        {
            // get transaction details
            GetExpressCheckoutDetailsResponseType resp = Session["CheckoutDetails"] as GetExpressCheckoutDetailsResponseType;

            // prepare for commiting transaction
            DoExpressCheckoutPaymentReq payReq = new DoExpressCheckoutPaymentReq()
            {
                DoExpressCheckoutPaymentRequest = new DoExpressCheckoutPaymentRequestType()
                {
                    Version = UtilPayPalAPI.Version,
                    DoExpressCheckoutPaymentRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType()
                    {
                        Token = resp.GetExpressCheckoutDetailsResponseDetails.Token,
                        PaymentAction = PaymentActionCodeType.Sale,
                        PayerID = resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID,
                        PaymentDetails = new PaymentDetailsType()
                        {
                            OrderTotal = new BasicAmountType()
                            {
                                currencyID = CurrencyCodeType.USD,
                                Value = "10.00"
                            }
                        },
                    }
                }
            };

            // commit transaction and display results to user
            DoExpressCheckoutPaymentResponseType doResponse =
                UtilPayPalAPI.BuildPayPalWebservice().DoExpressCheckoutPayment(payReq);
            UtilPayPalAPI.HandleError(doResponse);

            Label1.Text = "Payment was successfully processed!";
            finishTransactionButton.Visible = false;
        }
示例#2
0
 /// <remarks/>
 public void DoExpressCheckoutPaymentAsync(DoExpressCheckoutPaymentReq DoExpressCheckoutPaymentReq, object userState) {
     if ((this.DoExpressCheckoutPaymentOperationCompleted == null)) {
         this.DoExpressCheckoutPaymentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDoExpressCheckoutPaymentOperationCompleted);
     }
     this.InvokeAsync("DoExpressCheckoutPayment", new object[] {
                 DoExpressCheckoutPaymentReq}, this.DoExpressCheckoutPaymentOperationCompleted, userState);
 }
示例#3
0
 /// <remarks/>
 public void DoExpressCheckoutPaymentAsync(DoExpressCheckoutPaymentReq DoExpressCheckoutPaymentReq) {
     this.DoExpressCheckoutPaymentAsync(DoExpressCheckoutPaymentReq, null);
 }