Registering a Card

Albert Mata edited this page Oct 11, 2016 · 5 revisions

Before you make a payment please check if your SDK is initialized

Registering a new card

Card registration is done through conducting a pre-authorization configured to reserve £1.01 in the customer’s bank account, which then can be Voided in order for transaction not to appear in the customer’s bank statement.

In order to register a new card you need to perform the request with full card details:

    $registerCard = $judopay->getModel('RegisterCard');
            'judoId' => 'your_judo_id',
            'yourConsumerReference' => '12345',
            'yourPaymentReference' => '12345',
            'amount' => 1.01,
            'currency' => 'GBP',
            'cardNumber' => '4976000000003436',
            'expiryDate' => '12/15',
            'cv2' => 452

Note: Please make sure that you are using a unique Consumer Reference for each different consumer, and a unique Payment Reference for each transaction.

You can check on the required fields and the format of each field in the Judopay REST API reference.

Check the result

After you fill RegisterCard model you need to send the request to the API. Your code will look like that:

    $response = $registerCard->create();
    if ($response['result'] === 'Success') {
        echo 'Card registered successfully';
    } else {
        echo 'There were some problems while processing your request';

If the register card is successful, you'll receive a response array like this:

    [receiptId] => xxxxxxxx
    [yourPaymentReference] => xxxxxxxxxxxx
    [type] => PreAuth
    [createdAt] => 2016-08-15T09:54:58.2199+01:00
    [result] => Success
    [message] => AuthCode: xxxxxx
    [judoId] => xxxxxx
    [merchantName] => xxxxx
    [appearsOnStatementAs] => xxxxxxxx    
    [originalAmount] => 1.01
    [amountCollected] => 0.00
    [netAmount] => 1.01
    [amount] => 1.01
    [currency] => GBP
    [cardDetails] => Array
            [cardLastfour] => 3436
            [endDate] => 1216
            [cardToken] => xxxxxxxxxxxxxxx
            [cardType] => 1

    [consumer] => Array
            [consumerToken] => xxxxxxxxxxxx
            [yourConsumerReference] => 12345

    [risks] => Array
            [postCodeCheck] => UNKNOWN


After that you need to save cardToken & consumerToken values to perform a Token Payments

It is also important to handle different exceptions in your code. See our Error handling section.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.