* PHP 5.3+
require ‘vendor/autoload.php’;
$ git clone https://github.com/epayco/epayco-php.git
$epayco = new Epayco\Epayco(array(
«apiKey» => «YOU_PUBLIC_API_KEY»,
«privateKey» => «YOU_PRIVATE_API_KEY»,
«lenguage» => «ES»,
«test» => true
));
$token = $epayco->token->create(array(
«card[number]» => ‘4575623182290326’,
«card[exp_year]» => «2017»,
«card[exp_month]» => «07»,
«card[cvc]» => «123»
));
$customer = $epayco->customer->create(array(
«token_card» => $token->id,
«name» => «Joe»,
«last_name» => «Doe», //This parameter is optional
«email» => «joe@payco.co»,
«default» => true,
//Optional parameters: These parameters are important when validating the credit card transaction
«city» => «Bogota»,
«address» => «Cr 4 # 55 36»,
«phone» => «3005234321»,
«cell_phone»=> «3010000001»,
));
$customer = $epayco->customer->get(«id_client»);
$customer = $epayco->customer->getList();
$customer = $epayco->customer->update(«id_client», array(‘name’ => ‘julianc’));
$customer = $epayco->customer->delete(array(
«franchise» => «visa»,
«mask» => «457562******0326»,
«customer_id»=>»id_client»
));
$customer = $epayco->customer->addDefaultCard(array(
«customer_id»=>»id_client»,
«token» => «**********zL4gFB»,
«franchise»=> «american-express»,
«mask»=> «373118*****7642»
));
$customer = $epayco->customer->addNewToken(array(
«token_card» => «HyjnY3pBSjFtiQBRT»,
«customer_id»=>»id_client»
));
$plan = $epayco->plan->create(array(
«id_plan» => «coursereact»,
«name» => «Course react js»,
«description» => «Course react and redux»,
«amount» => 30000,
«currency» => «cop»,
«interval» => «month»,
«interval_count» => 1,
«trial_days» => 30
));
$plan = $epayco->plan->get(«coursereact»);
$plan = $epayco->plan->getList();
$plan = $epayco->plan->remove(«coursereact»);
$sub = $epayco->subscriptions->create(array(
«id_plan» => «coursereact»,
«customer» => «id_client»,
«token_card» => «id_token»,
«doc_type» => «CC»,
«doc_number» => «5234567»,
//Optional parameter: if these parameter it’s not send, system get ePayco dashboard’s url_confirmation
«url_confirmation» => «https://ejemplo.com/confirmacion»,
«method_confirmation» => «POST»
));
$sub = $epayco->subscriptions->get(«id_subscription»);
$sub = $epayco->subscriptions->getList();
$sub = $epayco->subscriptions->cancel(«id_subscription»);
$sub = $epayco->subscriptions->charge(array(
«id_plan» => «coursereact»,
«customer» => «id_client»,
«token_card» => «id_token»,
«doc_type» => «CC»,
«doc_number» => «5234567»,
«address» => «cr 44 55 66»,
«phone»=> «2550102»,
«cell_phone»=> «3010000001»,
«ip» => «190.000.000.000» // This is the client’s IP, it is required
));