PHP code example of superbrave / omnipay-docdata-payments
1. Go to this page and download the library: Download superbrave/omnipay-docdata-payments 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/ */
superbrave / omnipay-docdata-payments example snippets
public function getAuthorizeData() {
$card = new CreditCard(); // Omnipay CC model
$card->setTitle(null);
$card->setFirstName($invoice->getCustomerFirstname());
$card->setLastName($invoice->getCustomerLastname());
$card->setEmail($invoice->getCustomerEmailAddress());
$card->setGender('U'); // U, F, M
$card->setPhone(null);
$card->setBillingFirstName($invoice->getCustomerFirstname());
$card->setBillingLastName($invoice->getCustomerLastname());
$card->setBillingAddress1($formatedAddress['street']);
$card->setBillingAddress2($formatedAddress['houseNumber']);
$card->setBillingPostcode($address->getPostalCode());
$card->setBillingCity(mb_substr($address->getCity(), 0, 35)); // max 35
$card->setBillingCountry(strtoupper($address->getCountry()));
$card->setBillingTitle(null);
$card->setBillingState(null);
$data = [
'description' => sprintf('Invoice #%s', $invoice->getReference()),
'paymentProfile' => $this->getDocDataPaymentProfile(), // set in Docdata backoffice
'paymentDays' => self::DOCDATA_INVOICE_VALIDITY_DAYS, // own choice
'transactionId' => sprintf('%s _ %s', $invoice->getReference(), Uuid::uuid4()), // shown to customer. Needs to be unique
'currency' => 'EUR', // capitalized
'amount' => 100,
'shopperId' => $invoice->getCustomerReference(),
'language' => 'en', // lowercase
'card' => $card,
'houseNumberAddition' => $formatedAddress['houseNumberAddition'],
'paymentMethod' => 'IDEAL',
];
/* Payment methods (defined by docdata)
* https://www.cmpayments.com/file_uploads/API_Integration_Manual.pdf #figure 9
*
* BanContact => 'MISTERCASH'
* Bank_transfer => 'BANK_TRANSFER'
* Elv => 'ELV'
* Eps => 'EPS'
* Giropay => 'GIROPAY'
* Ideal => 'IDEAL'
* Sofort => 'SOFORT_UEBERWEISUNG'
*/
return $data;
}