1. Go to this page and download the library: Download genesisgateway/genesis_php 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/ */
# Supported values: sandbox or production
environment = sandbox
# Supported values: test, testing, staging or live, prod, production
endpoint = ENTER_YOUR_ENDPOINT
# Credentials
username = ENTER_YOUR_USERNAME
password = ENTER_YOUR_PASSWORD
# Optional for WPF requests
token = ENTER_YOUR_TOKEN
# Smart Router endpoint for Financial Transactions
# Doesn't
{
// Load the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
\Genesis\Config::setToken('<enter_your_token>');
// Create a new Genesis instance with desired API request
$genesis = new \Genesis\Genesis('Financial\Cards\Authorize');
// Set request parameters
$genesis
->request()
->setTransactionId('43671')
->setUsage('40208 concert tickets')
->setRemoteIp('245.253.2.12')
->setAmount('50')
->setCurrency('USD')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
// Credit Card Details
->setCardHolder('Travis Pastrana')
->setCardNumber('4200000000000000')
->setExpirationMonth('01')
->setExpirationYear('2020')
->setCvv('123')
// Billing/Invoice Details
->setBillingFirstName('Travis')
->setBillingLastName('Pastrana')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US');
// Send the request
$genesis->execute();
// Successfully completed the transaction - display the gateway unique id
echo $genesis->response()->getResponseObject()->unique_id;
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
}
// Log/handle invalid parameters
// Example: Empty (
composer.phar update
{
// Load the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
// Create a new Genesis instance with Web Payment Form transaction request
/** @var \Genesis\Genesis $genesis */
$genesis = new Genesis('Wpf\Create');
// Assign $request variable. In some editors, auto-completion will guide you with the request building
/** @var \Genesis\Api\Request\Wpf\Create $request */
$request = $genesis->request();
// Set request parameters
$request
->setTransactionId('43671')
->setUsage('40208 concert tickets')
->setDescription('You are buying concert tickets!')
->setAmount('50')
->setCurrency('USD')
// Notification parameters
->setNotificationUrl('https://www.example.com/notification')
// Asynchronous parameters
->setReturnSuccessUrl('http://www.example.com/success')
->setReturnFailureUrl('http://www.example.com/failure')
->setReturnCancelUrl('http://www.example.com/cancel')
->setReturnPendingUrl('http://www.example.com/pending')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
// Billing/Invoice Details
->setBillingFirstName('Travis')
->setBillingLastName('Pastrana')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// Web Payment Form language, default is EN if no language is provided
->setLanguage(\Genesis\Api\Constants\i18n::EN)
// Set the Web Payment Form time to live, default value 30 minutes if no value is provided
->setLifetime(30)
// Transaction Type without Custom Attribute
->addTransactionType(\Genesis\Api\Constants\Transaction\Types::SALE_3D)
->addTransactionType(\Genesis\Api\Constants\Transaction\Types::AUTHORIZE_3D)
// Transaction Type with Custom Attribute
->addTransactionType(\Genesis\Api\Constants\Transaction\Types::PAYSAFECARD, ['customer_id' => '123456']);
// Send the request
$genesis->execute();
// Successfully completed the transaction - redirect the customer to the provided URL
echo $genesis->response()->getResponseObject()->redirect_url;
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
}
// Log/handle invalid parameters
// Example: Empty (
$genesis->response()->getResponseRaw()
$genesis->response()->getResponseObject()
$genesis->response()->getResponseCode()
if ($genesis->response()->isNew())...
...
$genesis->response()->isApproved()
$genesis->response()->isDeclined()
$genesis->response()->isError()
$genesis->response()->isPendingAsync()
...
\Genesis\Config::setForceSmartRouting(true);
$genesis->request()->setUseSmartRouter(true);
oad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
\Genesis\Config::setToken('<enter_your_token>');
try {
// Create a new Genesis instance with desired API request
$genesis = new \Genesis\Genesis('Financial\Cards\Sale3D');
/** @var \Genesis\Api\Request\Financial\Cards\Sale3D $sale_3ds_v2_request */
$sale_3ds_v2_request = $genesis->request();
// Set request parameters
$sale_3ds_v2_request
->setTransactionId('43671')
->setUsage('40208 concert tickets')
->setRemoteIp('245.253.2.12')
->setAmount('50')
->setCurrency('USD')
// Return URLS
->setNotificationUrl('https://example.com/notification')
->setReturnSuccessUrl('https://example.com/return?type=success')
->setReturnFailureUrl('https://example.com/return?type=cancel')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
// Credit Card Details
->setCardHolder('FirstName LastName')
// Test Cases
->setCardNumber('4012000000060085') // Test Case: Synchronous 3DSv2 Request with Frictionless flow
//->setCardNumber('4066330000000004') // Test Case: Asynchronous 3DSv2 Request with 3DS-Method and Frictionless flow
//->setCardNumber('4918190000000002') // Test Case: Asynchronous 3DSv2 Request with Challenge flow
//->setCardNumber('4938730000000001') // Test Case: Asynchronous 3DSv2 Request with 3DS-Method Challenge flow
//->setCardNumber('4901170000000003') // Test Case: Asynchronous 3DSv2 Request with Fallback flow
//->setCardNumber('4901164281364345') // Test Case: Asynchronous 3DSv2 Request with 3DS-Method Fallback flow
->setExpirationMonth('01')
->setExpirationYear('2020')
->setCvv('123')
// Billing/Invoice Details
->setBillingFirstName('John')
->setBillingLastName('Smith')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// 3DSv2 params
// 3DSv2 Method Attributes
->setThreedsV2MethodCallbackUrl('https://www.example.com/threeds/threeds_method/callback')
// 3DSv2 Control Attributes
->setThreedsV2ControlDeviceType(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Control\DeviceTypes::BROWSER)
->setThreedsV2ControlChallengeWindowSize(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Control\ChallengeWindowSizes::FULLSCREEN)
->setThreedsV2ControlChallengeIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Control\ChallengeIndicators::PREFERENCE)
// 3DSv2 Purchase Attributes
->setThreedsV2PurchaseCategory(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Purchase\Categories::SERVICE)
// 3DSv2 Merchant Risk Attributes
->setThreedsV2MerchantRiskShippingIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\ShippingIndicators::VERIFIED_ADDRESS)
->setThreedsV2MerchantRiskDeliveryTimeframe(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\DeliveryTimeframes::ELECTRONICS)
->setThreedsV2MerchantRiskReorderItemsIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\ReorderItemIndicators::REORDERED)
->setThreedsV2MerchantRiskPreOrderPurchaseIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\PreOrderPurchaseIndicators::MERCHANDISE_AVAILABLE)
->setThreedsV2MerchantRiskPreOrderDate('31-12-2030')
->setThreedsV2MerchantRiskGiftCard(true) // Boolean attribute. Accepts values like `on`, `off`, `yes`, `no`, `true`, `false`, etc...
->setThreedsV2MerchantRiskGiftCardCount(99)
// 3DSv2 Cardholder Account Attributes
->setThreedsV2CardHolderAccountCreationDate('31-12-2019')
->setThreedsV2CardHolderAccountUpdateIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\UpdateIndicators::FROM_30_TO_60_DAYS)
->setThreedsV2CardHolderAccountLastChangeDate('31-12-2019')
->setThreedsV2CardHolderAccountPasswordChangeIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\PasswordChangeIndicators::NO_CHANGE)
->setThreedsV2CardHolderAccountPasswordChangeDate('31-12-2019')
->setThreedsV2CardHolderAccountShippingAddressUsageIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\ShippingAddressUsageIndicators::CURRENT_TRANSACTION)
->setThreedsV2CardHolderAccountShippingAddressDateFirstUsed('31-12-2019')
->setThreedsV2CardHolderAccountTransactionsActivityLast24Hours(2)
->setThreedsV2CardHolderAccountTransactionsActivityPreviousYear(10)
->setThreedsV2CardHolderAccountProvisionAttemptsLast24Hours(1)
->setThreedsV2CardHolderAccountPurchasesCountLast6Months(5)
->setThreedsV2CardHolderAccountSuspiciousActivityIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\SuspiciousActivityIndicators::NO_SUSPICIOUS_OBSERVED)
->setThreedsV2CardHolderAccountRegistrationIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\RegistrationIndicators::FROM_30_TO_60_DAYS)
->setThreedsV2CardHolderAccountRegistrationDate('31-12-2019')
// 3DSv2 Browser Attributes
->setThreedsV2BrowserAcceptHeader('*/*') // Exact content of the HTTP accept headers as sent to the 3DS Requester from the Cardholder browser
->setThreedsV2BrowserJavaEnabled(false) // Boolean attribute. Accepts values like `on`, `off`, `yes`, `no`, `true`, `false`, etc...
->setThreedsV2BrowserLanguage('en-GB')
->setThreedsV2BrowserColorDepth(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Browser\ColorDepths::BITS_32)
->setThreedsV2BrowserScreenHeight(900)
->setThreedsV2BrowserScreenWidth(1440)
->setThreedsV2BrowserTimeZoneOffset(-120)
->setThreedsV2BrowserUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36')
// 3DSv2 SDK Attributes
->setThreedsV2SdkInterface(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Sdk\Interfaces::NATIVE)
->setThreedsV2SdkUiTypes( // Also accepts a single string value ->setThreedsV2SdkUiTypes('text')
[
\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Sdk\UiTypes::SINGLE_SELECT,
\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Sdk\UiTypes::MULTI_SELECT,
\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Sdk\UiTypes::TEXT
]
)
->setThreedsV2SdkApplicationId('fc1650c0-5778-0138-8205-2cbc32a32d65')
->setThreedsV2SdkEncryptedData('encrypted-data-here')
->setThreedsV2SdkEphemeralPublicKeyPair('public-key-pair')
->setThreedsV2SdkMaxTimeout(10)
->setThreedsV2SdkReferenceNumber('sdk-reference-number-her');
// 3DSv2 Recurring Attributes
// Available only for the Init Recurring Sale 3D Request
//$sale_3ds_v2_request
// ->setThreedsV2RecurringExpirationDate('12-12-2030')
// ->setThreedsV2RecurringFrequency(2);
// Send the request
$genesis->execute();
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
// Un/Successfully completed the transaction - display the gateway unique id
echo $genesis->response()->getResponseObject()->unique_id;
// Status of the initial request
$status = $genesis->response()->getResponseObject()->status ?? '';
echo $status;
switch ($status) {
case \Genesis\Api\Constants\Transaction\States::APPROVED:
// Transaction approved no customer action
oad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
try {
// Create a new Genesis instance with desired API request
$genesis = new \Genesis\Genesis('Wpf\Create');
/** @var \Genesis\Api\Request\Wpf\Create $wpf_3ds_v2_request */
$wpf_3ds_v2_request = $genesis->request();
$wpf_3ds_v2_request
->setTransactionId('43671')
->setUsage('40208 concert tickets')
->setAmount('50')
->setCurrency('USD')
// Return URLS
->setNotificationUrl('https://example.com/notification')
->setReturnSuccessUrl('https://example.com/return?type=success')
->setReturnFailureUrl('https://example.com/return?type=failure')
->setReturnCancelUrl('https://example.com/return?type=cancel')
// Optional Url used for specific cases
->setReturnPendingUrl('https://example.com/return?type=pending')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
// Billing/Invoice Details
->setBillingFirstName('John')
->setBillingLastName('Smith')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// Optional Description
->setDescription('Example Description')
// Desired Transaction Type
->addTransactionType('sale3d')
// 3DSv2 Control Attributes
->setThreedsV2ControlChallengeWindowSize(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Control\ChallengeWindowSizes::FULLSCREEN)
->setThreedsV2ControlChallengeIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Control\ChallengeIndicators::PREFERENCE)
// 3DSv2 Purchase Attributes
->setThreedsV2PurchaseCategory(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\Purchase\Categories::SERVICE)
// 3DSv2 Merchant Risk Attributes
->setThreedsV2MerchantRiskShippingIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\ShippingIndicators::VERIFIED_ADDRESS)
->setThreedsV2MerchantRiskDeliveryTimeframe(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\DeliveryTimeframes::ELECTRONICS)
->setThreedsV2MerchantRiskReorderItemsIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\ReorderItemIndicators::REORDERED)
->setThreedsV2MerchantRiskPreOrderPurchaseIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\MerchantRisk\PreOrderPurchaseIndicators::MERCHANDISE_AVAILABLE)
->setThreedsV2MerchantRiskPreOrderDate('31-12-2030') // For a pre-ordered purchase, the expected date that the merchandise will be available.
->setThreedsV2MerchantRiskGiftCard(true) // Boolean attribute. Accepts values like `on`, `off`, `yes`, `no`, `true`, `false`, etc...
->setThreedsV2MerchantRiskGiftCardCount(99)
// 3DSSv2 Cardholder Account Attributes
->setThreedsV2CardHolderAccountCreationDate('31-12-2019')
->setThreedsV2CardHolderAccountUpdateIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\UpdateIndicators::FROM_30_TO_60_DAYS)
->setThreedsV2CardHolderAccountLastChangeDate('31-12-2019')
->setThreedsV2CardHolderAccountPasswordChangeIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\PasswordChangeIndicators::NO_CHANGE)
->setThreedsV2CardHolderAccountPasswordChangeDate('31-12-2019')
->setThreedsV2CardHolderAccountShippingAddressUsageIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\ShippingAddressUsageIndicators::CURRENT_TRANSACTION)
->setThreedsV2CardHolderAccountShippingAddressDateFirstUsed('31-12-2019')
->setThreedsV2CardHolderAccountTransactionsActivityLast24Hours(2)
->setThreedsV2CardHolderAccountTransactionsActivityPreviousYear(10)
->setThreedsV2CardHolderAccountProvisionAttemptsLast24Hours(1)
->setThreedsV2CardHolderAccountPurchasesCountLast6Months(5)
->setThreedsV2CardHolderAccountSuspiciousActivityIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\SuspiciousActivityIndicators::NO_SUSPICIOUS_OBSERVED)
->setThreedsV2CardHolderAccountRegistrationIndicator(\Genesis\Api\Constants\Transaction\Parameters\Threeds\V2\CardHolderAccount\RegistrationIndicators::FROM_30_TO_60_DAYS)
->setThreedsV2CardHolderAccountRegistrationDate('31-12-2019')
// 3DSv2 Recurring Attributes
// Available only for the Init Recurring Sale 3D Request
->setThreedsV2RecurringExpirationDate('12-12-2030') // A future date indicating the end date for any further subsequent transactions.
->setThreedsV2RecurringFrequency(2);
// Send the request
$genesis->execute();
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
// Upon successful `$genesis->response()->isNew()`
// Redirect to the Web Payment Form
echo $genesis->response()->getResponseObject()->redirect_url;
// ThreedsV2 Signature
echo $genesis->request()->generateThreedsV2Signature();
}
// Log/handle invalid parameters
// Example: Empty (
oad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
\Genesis\Config::setToken('<enter_your_token>');
try {
// Create a new Genesis instance with desired API request
$genesis_3ds_v2_continue = new \Genesis\Genesis('Financial\Cards\Threeds\V2\MethodContinue');
/** @var \Genesis\Api\Request\Financial\Cards\Threeds\V2\MethodContinue $continueRequest */
$genesis_3ds_v2_continue_request = $genesis_3ds_v2_continue->request();
$genesis_3ds_v2_continue_request
// Amount in minor currency unit
// If the AMOUNT is not in a minor currency unit then SET the CURRENCY. The AMOUNT will be converted into minor currency unit internally using the CURRENCY property.
// Ex. ->setAmount(10.00)->setCurrency('EUR'); The AMOUNT in that case for signature generation will be 1000
// Amount is included in the response from the initial request in major currency unit $genesis->response()->getResponseObject()->amount
->setAmount(10.00)
// If CURRENCY is set, AMOUNT value will be converted into MINOR currency unit
// If you SET the AMOUNT in MINOR currency unit DO NOT set CURRENCY
// Currency is included in the response from the initial request in major currency unit $genesis->response()->getResponseObject()->currency
->setCurrency('EUR')
// Set only one of the unique_id or url
//->setUrl("https://staging.gate.emerchantpay.net/threeds/threeds_method/d6a6aa96292e4856d4a352ce634a4335")
->setTransactionUniqueId('d6a6aa96292e4856d4a352ce634a4335')
// String representation of the timestamp
// ->setTransactionTimestamp(
// $responseObject->timestamp->format(
// \Genesis\Api\Constants\DateTimeFormat::YYYY_MM_DD_H_I_S_ZULU
// )
// )
->setTransactionTimestamp('2020-12-31T23:59:59Z');
$genesis_3ds_v2_continue->execute();
// If there is an error - display the error information
if (!$genesis_3ds_v2_continue->response()->isSuccessful()) {
echo "Error code: {$genesis_3ds_v2_continue->response()->getResponseObject()->code}\n";
echo "Message: {$genesis_3ds_v2_continue->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis_3ds_v2_continue->response()->getResponseObject()->technical_message}\n";
}
$status = $genesis_3ds_v2_continue->response()->getResponseObject()->status ?? '';
switch ($status) {
// Asynchronous 3DSv2 Request with 3DS-Method and Frictionless flow
// Transaction approved no customer action
ad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
\Genesis\Config::setToken('<enter_your_token>');
// Google Pay token
$jsonToken = "{\"protocolVersion\":\"ECv2\",\"signature\":\"MEQCIH6Q4OwQ0jAceFEkGF0JID6sJNXxOEi4r+mA7biRxqBQAiAondqoUpU\/bdsrAOpZIsrHQS9nwiiNwOrr24RyPeHA0Q\\u003d\\u003d\",\"intermediateSigningKey\":{\"signedKey\": \"{\\\"keyExpiration\\\":\\\"1542323393147\\\",\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE\/1+3HBVSbdv+j7NaArdgMyoSAM43yRydzqdg1TxodSzA96Dj4Mc1EiKroxxunavVIvdxGnJeFViTzFvzFRxyCw\\u003d\\u003d\\\"}\", \"signatures\": [\"MEYCIQCO2EIi48s8VTH+ilMEpoXLFfkxAwHjfPSCVED\/QDSHmQIhALLJmrUlNAY8hDQRV\/y1iKZGsWpeNmIP+z+tCQHQxP0v\"]},\"signedMessage\":\"{\\\"tag\\\":\\\"jpGz1F1Bcoi\/fCNxI9n7Qrsw7i7KHrGtTf3NrRclt+U\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BJatyFvFPPD21l8\/uLP46Ta1hsKHndf8Z+tAgk+DEPQgYTkhHy19cF3h\/bXs0tWTmZtnNm+vlVrKbRU9K8+7cZs\\u003d\\\",\\\"encryptedMessage\\\":\\\"mKOoXwi8OavZ\\\"}\"}";
$decodedToken = json_decode($jsonToken, true);
// Create a new Genesis instance with Google Pay API request
$genesis = new Genesis('Financial\Mobile\GooglePay');
// Set request parameters
$genesis->request()
// Add Google Pay token details
// Use ->setJsonToken($jsonToken) with JSON string for $jsonToken
->setTokenSignature($decodedToken['signature'])
->setTokenSignedKey($decodedToken['intermediateSigningKey']['signedKey'])
->setTokenProtocolVersion($decodedToken['protocolVersion'])
->setTokenSignedMessage($decodedToken['signedMessage'])
->setTokenSignatures($decodedToken['intermediateSigningKey']['signatures']) // Token Signatures accepts array value
// Set request parameters
->setTransactionId('43671')
->setPaymentSubtype(\Genesis\Api\Constants\Transaction\Parameters\Mobile\GooglePay\PaymentTypes::SALE)
->setUsage('40208 concert tickets')
->setRemoteIp('245.253.2.12')
->setAmount('50')
->setCurrency('USD')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
// Billing/Invoice Details
->setBillingFirstName('Travis')
->setBillingLastName('Pastrana')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// Shipping Details
->setShippingFirstName('Travis')
->setShippingLastName('Pastrana')
->setShippingAddress1('Muster Str. 12')
->setShippingZipCode('10178')
->setShippingCity('Los Angeles')
->setShippingState('CA')
->setShippingCountry('US');
try {
// Send the request
$genesis->execute();
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
// Successfully completed the transaction - display the gateway unique id
echo $genesis->response()->getResponseObject()->unique_id;
}
// Log/handle invalid parameters
// Example: Empty (
ad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
// Create a new Genesis instance with Web Payment Form request
$genesis = new Genesis('Wpf\Create');
// Set request parameters
$genesis
->request()
->setTransactionId('43671')
->setUsage('40208 concert tickets')
->setDescription('WPF Google Pay test transaction')
->setAmount('50')
->setCurrency('USD')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
->setNotificationUrl('https://example.com/notification')
->setReturnSuccessUrl('https://example.com/return?type=success')
->setReturnFailureUrl('https://example.com/return?type=failure')
->setReturnCancelUrl('https://example.com/return?type=cancel')
// Billing/Invoice Details
->setBillingFirstName('Travis')
->setBillingLastName('Pastrana')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// Shipping Details
->setShippingFirstName('Travis')
->setShippingLastName('Pastrana')
->setShippingAddress1('Muster Str. 12')
->setShippingZipCode('10178')
->setShippingCity('Los Angeles')
->setShippingState('CA')
->setShippingCountry('US')
->setLanguage(\Genesis\Api\Constants\i18n::EN)
->addTransactionType('google_pay', ['payment_subtype' => 'sale']);
try {
// Send the request
$genesis->execute();
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
// Successfully completed the transaction - display the gateway unique id
echo $genesis->response()->getResponseObject()->unique_id;
}
// Log/handle invalid parameters
// Example: Empty (
ad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
\Genesis\Config::setToken('<enter_your_token>');
// Apple Pay token
$jsonToken = '{"paymentData":{"version":"EC_v1","data":"MgcrhHr/uhfRy7zxMOvahhf5sp+ZfUsWADlG5OhvZ8vEAybEouyk4tT8oYaOqlfNTdkJZl2tmCgyLReibOjW2RiXzw5S9ZtA6ISnEBjNFla9Hju1KJnxQ+QFIdSlhEDOq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5E2Y4UVcAiEA9m/1aZEshDD84jHpaa75AQeCGpwKEZaGt7FZcU3Y21EAAAAAAAA=","header":{"wrappedKey": "wrapped key", "ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJsaMBlzR3D0H7xKwDncLNGOEcsl6Jilx5d+MDI/1QFxuIf6a0fY5qgOwnuLgZepqc3AVeU1RV8enPCQSWfFKRg==","publicKeyHash":"QOmvMaoCNYk5tv+69KC1i2UCFQcOl6LYPIJfYAT+SLQ=","transactionId":"ccedaf3f32efcc971259694f0efd0dcaa0ed545e7a31a0f7ec8e1c110656c25b"}},"paymentMethod":{"displayName":"Visa 0225","network":"Visa","type":"debit"},"transactionIdentifier":"CCEDAF3F32EFCC971259694F0EFD0DCAA0ED545E7A31A0F7EC8E1C110656C25B"}';
$decodedToken = json_decode($jsonToken, true);
// Create a new Genesis instance with Apple Pay API request
$genesis = new Genesis('Financial\Mobile\ApplePay');
// Set request parameters
$genesis->request()
// Add Apple Pay token details
// Use ->setJsonToken($jsonToken) with JSON string for $jsonToken
->setTokenVersion($decodedToken['paymentData']['version'])
->setTokenData($decodedToken['paymentData']['data'])
->setTokenSignature($decodedToken['paymentData']['signature'])
->setTokenEphemeralPublicKey($decodedToken['paymentData']['header']['ephemeralPublicKey'])
->setTokenPublicKeyHash($decodedToken['paymentData']['header']['publicKeyHash'])
->setTokenTransactionId($decodedToken['paymentData']['header']['transactionId'])
->setTokenDisplayName($decodedToken['paymentMethod']['displayName'])
->setTokenNetwork($decodedToken['paymentMethod']['network'])
->setTokenType($decodedToken['paymentMethod']['type'])
->setTokenTransactionIdentifier($decodedToken['transactionIdentifier'])
// Set request parameters
->setTransactionId('43671')
->setPaymentSubtype(\Genesis\Api\Constants\Transaction\Parameters\Mobile\ApplePay\PaymentTypes::SALE)
->setUsage('40208 concert tickets')
->setRemoteIp('245.253.2.12')
->setAmount('50')
->setCurrency('USD')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
// Billing/Invoice Details
->setBillingFirstName('Travis')
->setBillingLastName('Pastrana')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// Shipping Details
->setShippingFirstName('Travis')
->setShippingLastName('Pastrana')
->setShippingAddress1('Muster Str. 12')
->setShippingZipCode('10178')
->setShippingCity('Los Angeles')
->setShippingState('CA')
->setShippingCountry('US');
try {
// Send the request
$genesis->execute();
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
// Successfully completed the transaction - display the gateway unique id
echo $genesis->response()->getResponseObject()->unique_id;
}
// Log/handle invalid parameters
// Example: Empty (
ad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
// Create a new Genesis instance with Web Payment Form request
$genesis = new Genesis('Wpf\Create');
// Set request parameters
$genesis
->request()
->setTransactionId('43671')
->setUsage('40208 concert tickets')
->setDescription('WPF Apple Pay test transaction')
->setAmount('50')
->setCurrency('USD')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
->setNotificationUrl('https://example.com/notification')
->setReturnSuccessUrl('https://example.com/return?type=success')
->setReturnFailureUrl('https://example.com/return?type=failure')
->setReturnCancelUrl('https://example.com/return?type=cancel')
// Billing/Invoice Details
->setBillingFirstName('Travis')
->setBillingLastName('Pastrana')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// Shipping Details
->setShippingFirstName('Travis')
->setShippingLastName('Pastrana')
->setShippingAddress1('Muster Str. 12')
->setShippingZipCode('10178')
->setShippingCity('Los Angeles')
->setShippingState('CA')
->setShippingCountry('US')
->setLanguage(\Genesis\Api\Constants\i18n::EN)
->addTransactionType('apple_pay', ['payment_subtype' => 'sale']);
try {
// Send the request
$genesis->execute();
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
// Successfully completed the transaction - display the gateway unique id
echo $genesis->response()->getResponseObject()->unique_id;
}
// Log/handle invalid parameters
// Example: Empty (
// Load the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
$transaction_id = uniqid();
try {
$genesis = new Genesis('Financial\Alternatives\Invoice\Authorize');
$request = $genesis->request();
$request
->setTransactionId($transaction_id)
->setPaymentType('secure_invoice')
->setUsage('40208 concert tickets')
->setPaymentMethodCategory('pay_over_time')
->setReturnSuccessUrl('http://www.example.com/success')
->setReturnFailureUrl('http://www.example.com/failure')
->setUsage('40208 concert tickets')
->setRemoteIp('245.253.2.12')
->setCurrency('EUR')
// amount in major unit format ex 434.96 for EUR currency
->setAmount('414.96')
->setCustomerPhone('1987987987987')
->setCustomerEmail('[email protected]')
->setCustomerGender('male')
->setCustomerBirthdate('1990-03-20')
->setCustomerReferenceNumber('123')
// Billing Address
->setBillingFirstName('Travis')
->setBillingLastName('Pastrana')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Berlin')
->setBillingNeighborhood('Lichtenberg')
->setBillingState('Berlin')
->setBillingCountry('DE')
// Shipping Address
->setShippingFirstName('Travis')
->setShippingLastName('Pastrana')
->setShippingAddress1('Muster Str. 12')
->setShippingZipCode('10178')
->setShippingCity('Berlin')
->setShippingNeighborhood('Lichtenberg')
->setShippingState('Berlin')
->setShippingCountry('DE');
// Transaction Items
$item = new \Genesis\Api\Request\Financial\Alternatives\Transaction\Item();
$item
->setName('BatteryPowerPack')
->setItemType('physical')
->setQuantity('1')
// UnitPrice in major unit format ex 59.99 for EUR currency
->setUnitPrice('59.99')
// Non-negative. In percent, two implicit decimals. I.e 2500 = 25.00 percent
->setTaxRate('0.05')
// TotalDiscountAmount in major unit format ex 0.10 for EUR currency
->setTotalDiscountAmount('0.10')
->setReference('19-402-USA')
->setImageUrl('https://example.com/image_url')
->setProductUrl('https://example.com/product_url')
->setQuantityUnit('pcs')
->addMerchantMarketplaceSellerInfo('Electronic gadgets');
$productIdentifiers = new ProductIdentifiers();
$productIdentifiers->setBrand('Brand');
$productIdentifiers->setCategoryPath('Category Path');
$productIdentifiers->setGlobalTradeItemNumber('GTIN');
$productIdentifiers->setManufacturerPartNumber('MPN');
$item->setProductIdentifiers($productIdentifiers);
$request->addItem($item);
$item = new \Genesis\Api\Request\Financial\Alternatives\Transaction\Item();
$item
->setName('Massager')
->setItemType('physical')
->setQuantity('3')
// UnitPrice in major unit format ex 124.99 for EUR currency
->setUnitPrice('124.99')
// Non-negative. In percent, two implicit decimals. I.e 2500 = 25.00 percent
->setTaxRate('0.05')
// TotalDiscountAmount major unit format ex 0.10 for EUR currency
->setTotalDiscountAmount('0.10')
->setReference('19-402-USA')
->setImageUrl('https://example.com/image_url')
->setProductUrl('https://example.com/product_url')
->setQuantityUnit('pcs')
->addMerchantMarketplaceSellerInfo('Electronic gadgets');
$request->addItem($item);
$genesis->execute();
oad the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
try {
// Create a new Genesis instance with desired API request
$genesis = new \Genesis\Genesis('Wpf\Create');
/** @var \Genesis\Api\Request\Wpf\Create $wpf_recurring_request */
$wpf_recurring_request = $genesis->request();
$wpf_recurring_request
->setTransactionId('43671')
->setUsage('40208 concert tickets')
->setAmount('0')
->setCurrency('USD')
// Return URLS
->setNotificationUrl('https://example.com/notification')
->setReturnSuccessUrl('https://example.com/return?type=success')
->setReturnFailureUrl('https://example.com/return?type=failure')
->setReturnCancelUrl('https://example.com/return?type=cancel')
// Optional Url used for specific cases
->setReturnPendingUrl('https://example.com/return?type=pending')
// Customer Details
->setCustomerEmail('[email protected]')
->setCustomerPhone('1987987987987')
// Billing/Invoice Details
->setBillingFirstName('John')
->setBillingLastName('Smith')
->setBillingAddress1('Muster Str. 12')
->setBillingZipCode('10178')
->setBillingCity('Los Angeles')
->setBillingState('CA')
->setBillingCountry('US')
// Optional Description
->setDescription('Example Description')
// Desired Transaction Type
->addTransactionType('init_recurring_sale');
// Example: Recurring V2 available for following transaction types: sale, sale3d, authorize, authorize3d
// Recurring Type can have one value of 'initial' or 'managed'
// ->addTransactionType('sale', ['recurring_type' => 'initial']);
// Send the request
$genesis->execute();
// If there is an error - display the error information
if (!$genesis->response()->isSuccessful()) {
echo "Error code: {$genesis->response()->getResponseObject()->code}\n";
echo "Message: {$genesis->response()->getResponseObject()->message}\n";
echo "Technical message: {$genesis->response()->getResponseObject()->technical_message}\n";
}
// Upon successful `$genesis->response()->isNew()`
// Redirect to the Web Payment Form
echo $genesis->response()->getResponseObject()->redirect_url;
}
// Log/handle invalid parameters
// Example: Empty (
d the pre-configured ini file...
\Genesis\Config::loadSettings('/path/to/config.ini');
// ...OR, optionally, you can set the credentials manually
\Genesis\Config::setEndpoint(\Genesis\Api\Constants\Endpoints::EMERCHANTPAY);
\Genesis\Config::setEnvironment(\Genesis\Api\Constants\Environments::STAGING);
\Genesis\Config::setUsername('<enter_your_username>');
\Genesis\Config::setPassword('<enter_your_password>');
// Add your Terminal Token for all Non-WPF (Web Payment Form/Checkout) requests
\Genesis\Config::setToken('<enter_your_token>');
try {
$notification = new \Genesis\Api\Notification($_POST);
// Reconciliation is generally optional, but
// it's a recommended practice to ensure
// that you have the latest information
$notification->initReconciliation();
// Application Logic
// ...
// for example, process the transaction status
// $status = $notification->getReconciliationObject()->status;
// Respond to Genesis
$notification->renderResponse();
}
catch (\Exception $e) {
error_log($e->getMessage());
}