Library to assist with the generation of CashPro Global Payments GPCSV files
composer require diablomedia/gpcsv
<?php
$payment = new GPCSV\Payment();
$payment->setDestinationCountry($country);
// Set other values...
$csv = new GPCSV\File();
$csv->addPayment($payment);
// Add other payments...
echo $csv->getCsvString();
By default, the Payment class will automatically strip unsupported characters from values that are sent to it. If you would prefer it to throw an error instead, you can disable the autoClean option:
<?php
$payment = new Payment(['autoClean' => false]);
// or:
$payment = new Payment();
$payment->setOptionAutomaticallyCleanFields(false);