This project is read-only.
The PayPal NVP API is a simple programmatic interface that allows you, the merchant, to access PayPal’s business functionality to:
  • Accept PayPal in checkout on your website using Express Checkout.
  • Charge a credit card using Direct Payment.
  • Capture payments previously authorized through Express Checkout, Direct Payment, or Website Payments Standard.
  • Reauthorize or void previous authorizations.
  • Pay one or more recipients using Mass Payment.
  • Issue full refunds or multiple partial refunds.
  • Search transactions using a start date or other criteria.
  • View details of a specific transaction.

Features Implemented

  • Direct Payment.
  • Express Checkout

 

DoDirectPayment payment = new DoDirectPayment();

payment.UserName = "APIUsername";
payment.Password = "APIPassword";
payment.Signature = "APISignature";
payment.ServerType = ServerType.Sandbox;              payment.SecurityMode = SecurityMode.Signature;

payment.Add(DoDirectPayment.Request.IPADDRESS, "127.0.0.1");

payment.Add(DoDirectPayment.Request.ACCT, this.PaymentModel.CardNumber);

          payment.Add(DoDirectPayment.Request.CREDITCARDTYPE, this.PaymentModel.CardType);

          payment.Add(DoDirectPayment.Request.CVV2, this.PaymentModel.CVV2Code);

          payment.Add(
            DoDirectPayment.Request.EXPDATE, this.PaymentModel.ExpirationMonth + this.PaymentModel.ExpirationYear);

          payment.Add(DoDirectPayment.Request.FIRSTNAME, this.PaymentModel.FirstName);
          payment.Add(DoDirectPayment.Request.LASTNAME, this.PaymentModel.LastName);
          payment.Add(DoDirectPayment.Request.EMAIL, userService.CurrentUser.Email);

          payment.Add(DoDirectPayment.Request.STREET, this.PaymentModel.StreetAddress);
          payment.Add(DoDirectPayment.Request.CITY, this.PaymentModel.City);
          payment.Add(DoDirectPayment.Request.STATE, this.PaymentModel.State);
          payment.Add(DoDirectPayment.Request.COUNTRYCODE, CountryCode.Get(this.PaymentModel.Country).Code);
          payment.Add(DoDirectPayment.Request.ZIP, this.PaymentModel.Zip);
          payment.Add(DoDirectPayment.Request.PAYMENTACTION, PaymentActionCode.Sale);
          payment.Add(DoDirectPayment.Request.CURRENCYCODE, CurrencyCode.USDollar);

          payment.Add(DoDirectPayment.Request.AMT, plan.Price.ToString());
          payment.Add(
            DoDirectPayment.Request.DESC,
            "Username: " + userService.CurrentUserName + ", Ad ID: " + ad.ID + ", Plan: " + plan.Name + ", Price: " +
            plan.Price);

          payment.Add(DoDirectPayment.Request.ZIP, this.PaymentModel.Zip);

          if (payment.Post())
          {
            transactionID = payment.Get(DoDirectPayment.Response.TRANSACTIONID);
	  // ok transaction is completed.	
     
          }

          if (payment.Errors.Count > 0)
          {
            throw new ApplicationException("Checkout Error: " + payment.Errors[0].LongMessage);
          }
        }

Last edited Oct 2, 2010 at 7:34 PM by isilverlabs, version 1

Comments

No comments yet.