Skip to content
This repository was archived by the owner on Mar 19, 2022. It is now read-only.

Getting token details

Alexander Vizhanov edited this page Apr 27, 2017 · 3 revisions
// Create a gateway for the WorldPay Gateway
// (routes to GatewayFactory::create)
$gateway = Omnipay::create('\\lembdev\\WorldPay\\Gateway');

// Initialise the gateway
$gateway->initialize([
    'serviceKey' => 'T_S_2addbca3-d0a5-486c-9f83-3d64b6c73288',
    'clientKey'  => 'T_C_c27428cd-9005-4dd3-8f7e-734c06a79abd',
]);

// Do a create card transaction on the gateway
$response = $gateway->fetchCard([
    'token' => 'CARD_TOKEN',
])->send();

if ($response->isSuccessful()) {
    echo "Gateway createCard was successful.\n";

    $cardToken = $response->getToken();
    echo "Credit Card token = {$cardToken}\n";

    $cardDetails = $response->getCard();
}
Clone this wiki locally