1. Go to this page and download the library: Download emm/culqi-cashier library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
emm / culqi-cashier example snippets
php artisan migrate
use Emm\CulqiCashier\Facturable;
class User extends Authenticatable
{
use Facturable;
/**
* @return array
*/
public function culqiAntiFraud(): array
{
return [
"first_name" => $this->names,
"last_name" => $this->last_names,
"email" => $this->email,
"address" => $this->address,
"address_city" => $this->city',
"country_code" => $this->country_code,
"phone" => $this->mobile_phone,
"metadata" => [], // opcional
];
}
}
$description = 'Venta de Prueba';
$sourceId = request()->get('culqi_token');//ID del objeto Token u objeto Tarjeta que se va usar para realizar el cargo.
$antifraud = []; //opcional, si quieres reemplazar algunos datos de `culqiAntiFraud`
$user->charge($amount, $description,$sourceId, $antifraud);
$planId = 'plan_1'; // Nombre del plan que asignaste en el panel de culqi
$sourceId = request()->get('culqi_token');//ID del objeto Token u objeto Tarjeta que se va usar para realizar el cargo.
$user->newSubscription($planId', $sourceId);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.