Retrieve a payment link
**GET**
https://api.okepay.info/v1.0/Invoice/id/
PHPPythonBash
<?php
// $instanceName is a part of the url where you access your okepay installation.
// https://{$instanceName}.okepay.info
$instanceName = '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 = 'INSTANCE_API_SECRET';
$okepay = new \Okepay\Okepay($instanceName, $secret);
$invoice = new \Okepay\Models\Request\Invoice();
$invoice->setId(1);
try {
$response = $okepay->getOne($invoice);
var_dump($response);
} catch (\Okepay\OkepayException $e) {
print $e->getMessage();
}
import urllib.request
import hmac
import hashlib
import base64
import json
post_data = {}
data = urllib.parse.urlencode(post_data).encode('UTF-8')
dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()
post_data['instance'] = 'INSTANCE_NAME'
data = urllib.parse.urlencode(post_data)
result = urllib.request.urlopen('https://api.okepay.info/v1.0/Invoice/1/?' + data)
content = result.read().decode('UTF-8')
response = json.loads(content)
invoice = response['data'][0]
print(invoice)
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request GET "https://api.okepay.info/v1.0/Invoice/1/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
PATH PARAMS | |
---|---|
id | REQUIRED |
int32 | The id of the invoice to retrieve |
QUERY PARAMS | |
---|---|
instance | REQUIRED |
string | Your OkePay instance name |
Secure payment process using this endpoint
You could use this endpoint, for example, to verify a webhook you have received. You get a webhook successful payment and you would like to check whether this invoice has actually been paid.
Next to read:
Create a payment link
Create a payment link