rotassator / omnipay-payway-restapi

PayWay REST API gateway for Omnipay payment processing library
MIT License
4 stars 11 forks source link

Make a Purchase without creating new Customer #3

Closed ArjunKishore closed 7 years ago

ArjunKishore commented 7 years ago

As per the trusted frame documentation, It is possible for us to make a payment transaction without creating new customer. https://www.payway.com.au/docs/rest.html#transactions

This is possible if you send singleUseTokenId in Message/PurchaseRequest.php data array line number 40

if($this->getSingleUseTokenId()){ $data['singleUseTokenId'] = $this->getSingleUseTokenId(); }

So the implementation will go like this $gateway->setApiKeyPublic($this->publicKey); $gateway->setApiKeySecret($this->secretKey); $customerId = 'UNREGISTEDUSER01'; /// can be any value

        // process the payment
        $message = $gateway->purchase([
            'customerNumber' => $customerId,
            'singleUseTokenId' => $singleUseToken,
            'principalAmount' => 610.00,
            'currency' => 'AUD',
            'orderNumber' => 'ORDER'
        ]);
        $response = $message->send();

I hope someone will find this useful

rotassator commented 7 years ago

See https://github.com/rotassator/omnipay-payway-restapi/pull/5 for resolution.