Giter VIP home page Giter VIP logo

clifton.payment's Introduction

Clifton.Payment

Code relating to payment processing or point of sale

Check / Credit Card validation

Very basic check and credit card validation is provided. Keep in mind, web sites are better off using JavaScript to validate client side (rather than hitting the server to do validation).

Please note: this code is currently geared towards e-Commerce in the United States (but other payment logic is very welcome- submit a pull request!)

Supported payment gateways

Each gateway is intended to process payments over the internet. These are providers where you can setup a merchant account and send over credits, debits, refunds, etc.

First Data (Payeezy Gateway)

This integration is for the newer RESTful API.

Getting started

You can run test transactions with the values used in the unit tests (I've captured the values from the demo page). But you'll likely want to create your own account; here's how you get started:

  1. You'll want to sign up for an account (if you don't already have one). Visit the developer home page here and click "Create Account" in the top right of the site.
  2. Follow the instructions to create, verify, and login to your new account.
  3. Create a new app. It'll ask if you want this app to be a sandbox and I'd recommend saying yes (until your integration is perfect).
  4. Once your app is created, you can get the API key and API secret by opening the details for your new app and going to the "Keys" tab.
  5. The merchant token can be obtained by clicking "My Merchants" in the top right of the site. Grab the value in the token field (likely it's the demo account, Acme Sock).

At this point, you're ready add a reference to the Clifton.Payment assembly and start using it.

using Clifton.Payment.Gateway;

public class Demo {
  public function Charge() {
    PayeezyGateway gw = new PayeezyGateway(
        apiKey: "y6pWAJNyJyjGv66IsVuWnklkKUPFbb0a",
        apiSecret: "86fbae7030253af3cd15faef2a1f4b67353e41fb6799f576b5093ae52901e6f7",
        token: "fdoa-a480ce8951daa73262734cf102641994c1e55e7cdf4c02b6",
        environment: PayeezyEnvironment.Certification
    );
    var response = gw.CreditCardPurchase("4111111111111111", "01", "20", ...);
  }
}

Notes about the older SOAP API

Please note that I've removed the SOAP integration from this repo since it's an older (and less flexible) solution.

You can find the old integration here, but there are a few reasons why I don't think you should use it (and you should use the RESTful version instead).

  1. The developers have stated that the RESTful version is intended to be the new version. This means new features will be added to it.
  2. The older SOAP library only supports US merchants while the RESTful version supports US/UK and more countries/regions coming soon.
  3. There are way more examples available which show how to integrate with the RESTful APIs (in several programming languages).

License

Clifton.Payment is released under the MIT License. See the bundled LICENSE file for details.

clifton.payment's People

Contributors

besmiralia avatar bsclifton avatar redapollos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clifton.payment's Issues

Create a better name than `Clifton.Payment`

I originally picked this name because I was doing a lot of .NET and had multiple projects in the Clifton namespace (which is where I put all my personal library code)

Since there are other folks using this, it would be great to rename this to something more meaningful. Like PaymentHelper or something like that

Payeezy Gateway: Security Protocol Update to TLS v1.2

The API stopped working last week, returning 500 Internal Server Error.
Contacted the Payeezy team yesterday, and they advised us to ensure HTTP headers we’re negotiating the connection with TLS 1.2 only.

Added the line below inside of CreateRequest function and it fixed the issue
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Just a FYI, curious if there's any other ways to go around it.

Below is the link that notifies the enforcement of TLS v1.2
https://support.payeezy.com/hc/en-us/articles/115002769907-Payeezy-Gateway-Security-Protocol-Update-to-TLS-v1-2

Underlying connection was closed: could not establish trust relationship for the ssl/tls secure channel

Hi, first of all thank you so much for the code. It was all working fine until this morning when I tried to charge a payment on a car, I got the 500 error.
I tried opening a new test merchant account, to make sure there's nothing wrong from my end, but so far with no luck. I provided the error below, and hopefully this can help identify what the issue is.
Thank you,
Sean

{"Message":"An error has occurred.","ExceptionMessage":"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.","ExceptionType":"System.Net.WebException","StackTrace":" at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)\r\n at System.Net.HttpWebRequest.GetRequestStream()\r\n at Clifton.Payment.Gateway.PayeezyGateway.CreateRequest(String apiKey, String apiSecret, String token, String url, String payloadString) in C:\Users\Administrator\Documents\FC\FC\Clifton.Payment\Gateway\Payeezy\PayeezyGateway.cs:line 95\r\n at Clifton.Payment.Gateway.PayeezyGateway.ProcessRequest(Object payload, String relativeUrl) in C:\Users\Administrator\Documents\FC\FC\Clifton.Payment\Gateway\Payeezy\PayeezyGateway.cs:line 175\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n at Clifton.Payment.Gateway.PayeezyGateway.CreditCardPurchase(String cardNumber, String expirationMonth, String expirationYear, String dollarAmount, String cardHoldersName, String cardVerificationValue, String referenceNumber) in C:\Users\Administrator\Documents\FC\FC\Clifton.Payment\Gateway\Payeezy\PayeezyGateway.cs:line 266\r\n at FC.Controllers.CCPayeezyController.pay(PayeezyTransaction payload) in C:\Users\Administrator\Documents\FC\FC\Controllers\CCPayeezyController.cs:line 33\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"The remote certificate is invalid according to the validation procedure.","ExceptionType":"System.Security.Authentication.AuthenticationException","StackTrace":" at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)\r\n at System.Net.TlsStream.CallProcessAuthentication(Object state)\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)\r\n at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)\r\n at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)\r\n at System.Net.ConnectStream.WriteHeaders(Boolean async)"}}

CultureInfo issue

An exception keeps throwing saying that the year cannot be converted to a four digit year.

The CultureInfo appears to be incorrect. The argument should be "en-US" as opposed to just "US".

Does it offer all the functionality by Payeezy?

  • Is it work with only credit cards and not debit cards?
  • What if I want to save Credit Card information of a user on First data site?
  • What if difference between Authorize, Capture, Purchase, Void and Refund?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.