【问题标题】:How to process a refund with Omnipay - NAB Transact如何使用 Omnipay 处理退款 - NAB Transact
【发布时间】:2020-01-06 22:15:10
【问题描述】:

我正在尝试执行退款流程,它已连接到 nab 测试模式服务器,但未处理退款交易。

我昨天进行了一笔交易,想退还部分款项,但没有成功,并显示信用卡详细信息不可用的错误(错误代码 133)。

我正在使用 TransactionID 和 TransactionReference 发送请求以及要扣除但不工作的金额。

我的代码:-

public function pay()
    {
      $gateway = Omnipay::create('NABTransact_SecureXML');
    $gateway->setMerchantId('XYZ0010');
    $gateway->setTransactionPassword('abcd1234');
    $gateway->setTestMode(true);

    $card = new CreditCard([
            'firstName' => 'ABC',
            'lastName' => 'DEF',
            'number'      => '4444333322221111',
            'expiryMonth' => '05',
            'expiryYear'  => '2025',
            'cvv'         => '123',
        ]
    );

    $transaction = $gateway->purchase([
            'amount'        => '5000.00',
            'currency'      => 'AUD',
            'transactionId' => '100321', // (My order ID)
            'card'          => $card,
        ]
    );

    $response = $transaction->send();


    }

我在这里得到的transactionID是:706256

请在 NAB 中查看上述交易的截图:

    public function refund()
        {
          $gateway = Omnipay::create('NABTransact_SecureXML');
          $gateway->setMerchantId('XYZ0010');
          $gateway->setTransactionPassword('abcd1234');
          $gateway->setTestMode(true);

          $card = ([
                 'firstName' => 'ABC',
                 'lastName' => 'DEF',
                 'number'      => '4444333322221111',
                 'expiryMonth' => '05',
                 'expiryYear'  => '2025',
                 'cvv'         => '123',
             ]
         );

           $refund = $gateway->refund([
                           'transactionReference' => "706256",
                           'amount' => "5.00",
                           'currency' => "AUD",
                           'transactionId' => "100321",
                           'messageID' => '4',
                           'card' => $card,
                            ]);


             $refund->send();


        }

请在 NAB 中查看上述交易的截图 尝试退款:

【问题讨论】:

  • 嗨,你能做到吗?如果是,你能告诉我怎么做吗?谢谢

标签: php laravel payment-gateway omnipay


【解决方案1】:

是的,我已经解决了。

这是我的代码示例:

$gateway = Omnipay::create('NABTransact_SecureXML');
gateway->setMerchantId('_ID_');
$gateway->setTransactionPassword('_PASSWORD_');
$gateway->setTestMode(false); 

$refund = $gateway->refund([
            'transactionReference' => "12345",
            'amount' => "500",
            'transactionId' => 765897, (hope u must have saved this number in DB)
      ]);

  $response = $refund->send();
  $message = $response->getMessage();
  if ($response->isSuccessful()) {

   return "I m Happy"

    } else {
              return back()->with('amountError', $message);
           }
                    
       

让我知道结果如何:)

【讨论】:

    猜你喜欢
    • 2016-05-24
    • 2014-04-07
    • 1970-01-01
    • 2021-06-25
    • 2014-01-17
    • 2013-09-01
    • 2019-08-02
    • 2015-07-25
    • 1970-01-01
    相关资源
    最近更新 更多