$lastResponse
$lastResponse :
Allows your users to use otpbank.hu's online payment gateway.
__construct(\Guzzle\Http\ClientInterface $httpClient = null, \Symfony\Component\HttpFoundation\Request $httpRequest = null)
Create a new gateway instance
\Guzzle\Http\ClientInterface | $httpClient | A Guzzle client to make API calls with |
\Symfony\Component\HttpFoundation\Request | $httpRequest | A Symfony HTTP request object |
purchase(array $options) : \Clapp\OtpHu\Request\PaymentRequest
Start a new transaction on the gateway
Possible fields for $options are:
currency
string 3 letter currency code, e.g. HUF
amount
int|float|string amount of currency to charge (in any format accepted by number_format()
)language
string 2 letter language code, default: hu
Example:
$gateway->purchase([
'amount' => 100,
'currency' => 'HUF'
]);
array | $options | payment options |
the payment request that is ready to be sent to the gateway
completePurchase(array $options) : \Clapp\OtpHu\Request\TransactionDetailsRequest
Get the details of a transaction from the gateway, including whether or not it's already completed.
Possible fields for $options are:
transaction_id
string the transaction ID of the transactionExample:
$request = $gateway->completePurchase([
'transaction_id' => 'ATransactionIdFromOurDatabase',
]);
$response = $request->send();
array | $options | payment options |
the request that is ready to be sent to the gateway
setReturnUrl(string $value) : \Clapp\OtpHu\AbstractRequest
Sets the URL where the user will be redirected by the gateway after completing or cancelling the payment on the gateway's website.
string | $value | absolute url where the user can be redirected to |
Provides a fluent interface
setTransactionId(string $value)
Sets the transaction ID to use for the next purchase() request
The transaction ID will be used to refer to the transaction later with transactionDetails() or completePurchase() It should be unique for each purchase. If omitted, it will be auto generated by the gateway
string | $value | transaction id |
generateTransactionId(array $parameters = array()) : string
Generate a new, unique transaction ID to be used for a new purchase
The transaction ID should be unique to the shopID
array | $parameters | merged list of gateway purchase parameters |
new, unique transaction ID