Server SDKs
payFURL also provides a language specific SDK (with more coming), to provide a friendly interface over the API.
.Net SDK
This is available as a nuget package.
A simple example of this:
// initialise at startup
Config.Setup("<secret_key>", Environment.SANDBOX);
var charge = new NewChargeToken
{
Amount = 20,
Token = "5db53c06443c8f28c0cba6e5" // collected from payment form using Client SDK
};
// charge a token
var svc = new payfurl.sdk.Charge();
var result = svc.CreateWithToken(charge);
php SDK
This is available as a composer package.
A simple example of this:
<?
// initialise at startup
Config::initialise("<secret_key>", "SANDBOX");
$svc = new Charge();
$result = $svc->CreateWithToken([
"Amount" => 20,
"Token" => "5db53c06443c8f28c0cba6e5" // collected from payment form using Client SDK
]);
?>
Java SDK
This is available as a maven nexus package.
Example of adding maven payfurl dependency into project:
// initialise at startup
PayFurlClient payFurlClient = new PayFurlClient.Builder()
.withEnvironment(Environment.SANDBOX)
.withAccessToken("<secret_key>")
.build();
NewChargeToken newChargeToken = new NewChargeToken.Builder()
.withAmount(BigDecimal.valueOf(20))
.withToken("5db53c06443c8f28c0cba6e5") // collected from payment form using Client SDK
.build();
// charge a token
ChargeApi chargeApi = payFurlClient.getChargeApi();
ChargeData chargeData = chargeApi.createWithToken(newChargeToken);