protected void oneTimeButton_Click(object sender, EventArgs e)
        {
            // build request
            SetExpressCheckoutRequestDetailsType reqDetails = new SetExpressCheckoutRequestDetailsType();

            // TODO: Be sure to update hosting address in Web.Config!!
            string hostingOn = ConfigurationManager.AppSettings["HostingPrefix"];

            reqDetails.ReturnURL = hostingOn + "/API/ExpressCheckoutSuccess.aspx";
            reqDetails.CancelURL = hostingOn + "/API/ExpressCheckoutCancel.aspx";
            reqDetails.NoShipping = "1";
            reqDetails.OrderTotal = new BasicAmountType()
            {
                currencyID = CurrencyCodeType.USD,
                Value = "10.00"
            };

            SetExpressCheckoutReq req = new SetExpressCheckoutReq()
            {
                SetExpressCheckoutRequest = new SetExpressCheckoutRequestType()
                {
                    Version = UtilPayPalAPI.Version,
                    SetExpressCheckoutRequestDetails = reqDetails
                }
            };

            // query PayPal and get token
            SetExpressCheckoutResponseType resp = UtilPayPalAPI.BuildPayPalWebservice().SetExpressCheckout(req);
            UtilPayPalAPI.HandleError(resp);

            // redirect user to PayPal
            Response.Redirect(string.Format("{0}?cmd=_express-checkout&token={1}",
                ConfigurationManager.AppSettings["PayPalSubmitUrl"], resp.Token));
        }
Example #2
0
 /// <remarks/>
 public void SetExpressCheckoutAsync(SetExpressCheckoutReq SetExpressCheckoutReq, object userState) {
     if ((this.SetExpressCheckoutOperationCompleted == null)) {
         this.SetExpressCheckoutOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetExpressCheckoutOperationCompleted);
     }
     this.InvokeAsync("SetExpressCheckout", new object[] {
                 SetExpressCheckoutReq}, this.SetExpressCheckoutOperationCompleted, userState);
 }
Example #3
0
 /// <remarks/>
 public void SetExpressCheckoutAsync(SetExpressCheckoutReq SetExpressCheckoutReq) {
     this.SetExpressCheckoutAsync(SetExpressCheckoutReq, null);
 }