Perl
Our simple, straightforward API gets you up and running quickly.
-
1
Install
-
2
Set API Keys
-
3
Try Examples
Install the module using:
cpanm Net::Simplify
Alternatively the module may be
downloaded
and installed directly using:
perl Makefile.PL
make install
Dependencies
The Perl SDK has the following dependencies:
- Carp
- Crypt::Mac::HMAC
- JSON
- Mozilla::CA
- MIME::Base64
- Math::Random::Secure
- REST::Client
- Time::HiRes
- URI::Encode
Installing the module using cpanm automatically installs all dependencies.
Set your API Keys
After logging into your account, your API keys can be located at: Settings -> API Keys
To set your public and private API keys do the following:
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
Another option is to create an Authentication object which can be passed to API calls.
Examples
Charging a Card
You can charge a card in 2 ways. Once you have generated a card token using simplify.js, you can charge the card using the token. Alternatively, you can also charge a card by passing the card details.
For more information on the simplify.js go to Payments Form
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
my $payment = Net::Simplify::Payment->create({
token => "f21da65e-f0ab-45cb-b8e6-40b493c3671f",
amount => 1000,
currency => "USD",
description => "Description"
});
printf "Payment status %s\n", $payment->{paymentStatus};
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
my $payment = Net::Simplify::Payment->create({
card => {
number => "5555555555554444",
expMonth => "11",
expYear => "99",
cvc => "123"
},
amount => 1000,
currency => "USD",
description => "Description"
});
printf "Payment status %s\n", $payment->{paymentStatus};
For more examples see the api documentation or our tutorial