Charge a Pre-Authorized/Reserved Transaction
**POST**
https://api.okepay.info/v1.0/Transaction
PHPBash
// $instanceName is a part of the url where you access your okepay installation.
// https://{$instanceName}.okepay.info
$instanceName = 'YOUR_INSTANCE_NAME';
// $secret is the okepay secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the okepay administration
$secret = 'YOUR_SECRET';
$okepay = new \Okepay\Okepay($instanceName, $secret);
$transaction = new \Okepay\Models\Request\Transaction();
$transaction->setId(2);
// amount multiplied by 100
$transaction->setAmount(89.25 * 100);
try {
$response = $okepay->charge($transaction);
var_dump($response);
} catch (\Okepay\OkepayException $e) {
print $e->getMessage();
}
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request POST "https://api.okepay.info/v1.0/Transaction/2/?instance=INSTANCE_NAME" \
--data-urlencode "amount=8925" \
--data-urlencode "ApiSignature=$apiSignature"
QUERY PARAMS | |
---|---|
instance string |
REQUIRED Your OkePay instance name |
BODY PARAMS | |
---|---|
amount int32 |
Amount for charge in cents. |
Next to read:
Retrieve all Payment Providers
Retrieve all Payment Providers