skip to Main Content

How do I get card details later using card reference in unoapp-dev/omnipay-moneris

$card = $this->gateway->createCard(['card' => $card])->send();
$ref = $card->getCardReference();

Something like

$cardDetials = $this->gateway->getCardDetails(['cardReference' => $ref]);

Or

$cardDetials = $this->gateway->fetchProfile(['cardReference' => $ref]);

I tried to get card details after creating card using cardReference, couldn't find any documentations.
expect to get ```expiry_year, expiry_month```

2

Answers


  1. First, I use this version in composer.json:

    "require": {
        "unoapp-dev/omnipay-moneris": "2.2.0"
    }
    

    and I try these codes, and I do not use laravel framework:

    <?php
    require_once '../vendor/autoload.php';
    use OmnipayMonerisGateway;
    
    try {
        $gateway = new Gateway();
        $response = $gateway->createCard([
            'card' => [
                'email' => '[email protected]',
                'number' => '7777888899990000',
                'expiryMonth' => '12',
                'expiryYear' => '2038'
            ]
        ])->send();
        if ($response->isSuccessful()) {
            echo "successn";
        } else {
            echo "failn";
        }
        print_r($response->getData());exit;
    } catch (Exception $e) {
        echo '<pre>';
        echo 'errMsg:'.$e->getMessage().'  line-no:'.$e->getLine().'    trace:'.$e->getTraceAsString();
    }
    

    after run, you can use method "$response->isSuccessful()", if true, means success. but in var "$gateway", it does not have method "gateway->getCardDetails" or "gateway->fetchProfile".

    if you want to get the reponse detail, can use "$response->getData()".

    wish to help u!

    Login or Signup to reply.
  2. On the last answer, this dependency "unoapp-dev/omnipay-moneris": "2.2.0", it does not implement the methods "$this->gateway->getCardDetails" and "$this->gateway->fetchProfile", but u can implement by yourself.

    Referred by Moneris developers portal. It has many API.
    https://developer.moneris.com/Documentation/NA/E-Commerce%20Solutions/API/Vault?lang=php

    The Vault Get Expiring API can get the expired card, u can try.
    enter image description here

    and the core class MpgClasses can find in github:
    https://github.com/Moneris/eCommerce-Unified-API-PHP/blob/master/mpgClasses.php#L1185

    To refer the api doc and MpgClasses class, u can write your own many implementations and then place them in dependency "unoapp-dev/omnipay-moneris": "2.2.0".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search