Code relating to payment processing or point of sale
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!)
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.
This integration is for the newer RESTful API.
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:
- 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.
- Follow the instructions to create, verify, and login to your new account.
- 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).
- 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.
- 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", ...);
}
}
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).
- The developers have stated that the RESTful version is intended to be the new version. This means new features will be added to it.
- The older SOAP library only supports US merchants while the RESTful version supports US/UK and more countries/regions coming soon.
- There are way more examples available which show how to integrate with the RESTful APIs (in several programming languages).
Clifton.Payment is released under the MIT License. See the bundled LICENSE file for details.