Skip to content

Instantly share code, notes, and snippets.

<?php
// Setup Start object
require_once('./lib/Start.php');
Start::setApiKey("test_sec_k_e06df93760b388375e1f6");
// Get the customer ID (usually from your Database)
$customer_id = "cus_abc123def456ghi789";
// Charge the customer (can be done many times, over a period of time)
Start_Charge::create(array(
<?php
$token = $_POST['startToken']; // from Beautiful.js
require_once('./lib/Start.php');
Start::setApiKey("test_sec_k_e06df93760b388375e1f6");
Start_Customer::create(array(
"name" => "Abdullah Ahmed",
"email" => "abdullah@msn.com",
"card" => $token,
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/json"];
NSDictionary *params = @{@"amount":@"1000",
@"currency":@"aed",
@"email":@"ahmed@example.com",@"card[name]":@"Abdullah Ahmed",
@"card[number]":@"4242424242424242",
@"card[exp_month]":@"11",
@"card[exp_year]":@"2016",
@"card[cvc]":@"123",
@yazinsai
yazinsai / how-to-bill-a-token.php
Last active August 29, 2015 14:14
Bill a token -- John
# From https://whitepayments.com/docs/api/#create-a-new-charge
<?php
require_once('./lib/White.php');
White::setApiKey("test_sec_k_886a1e89b2c0abce479bf"); # Your secret API key
White_Charge::create(array(
"amount" => 1000, // 10.00
"currency" => "aed",
"card" => "tok_38951a48cd3859d2dcf62957e1c9", # The token from White.js
@yazinsai
yazinsai / charge.cs
Last active August 20, 2016 04:00
Creating a charge using C# with RestSharp
// White doesn't provide a C# wrapper library (yet), but you can still easily
// create charges by sending requests directly to the API. Here's how.
using RestSharp;
var client = new RestClient();
client.BaseUrl = "https://api.start.payfort.com/";
client.Authenticator = new HttpBasicAuthenticator("your_secret_api_key_here", "");
var request = new RestRequest("charges", Method.POST); // send a POST request
request.AddParameter("currency", "AED");
@yazinsai
yazinsai / index-without-token.php
Last active August 29, 2015 14:12
Create and charge a customer using pure PHP (for Alexey)
<?php
# Step 1: Create a customer from the card details
require_once("vendor/autoload.php");
White::setApiKey("test_sec_k_886a1e89b2c0abce479bf"); // Secret key
$customer = White_Customer::create(array(
'name' => "John Doe",
'description' => "Amember customer",
'email' => "john.doe@example.com",
'card' => array(