URL
/api/charge
Method:
POST
Header params
An authentication token is required to prevent unauthorized access to protected data.
Required:
-> auth_token=[string]
- authorization token
-> content-type
- application/json
amount=[string]
- amount in minor unitscurrency=[string]
- ISO 4217 currency code, eg BAM, USD, EURsource=[string]
- Payment method alias (pm_alias) or pan_tokenorder_number=[string]
- Unique order number (alphanumeric)order_info=[string]
- Order infoemail=[string]
- Valid email, required field ifsource
is pan_token. If sent withsource
pm_alias then it will overwrite pm_alias.email valuefull_name=[string]
- Full name, max length = 100. Required field ifsource
is pan_token. If sent withsource
pm_alias then it will overwrite pm_alias.full_name value
Example - pm alias
curl -X POST \
https://mobile.webteh.hr/pgw/api/charge \
-H 'Accept: application/json' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: mobile.webteh.hr' \
-H 'User-Agent: PostmanRuntime/7.17.1' \
-H 'auth_token: 00001111222233330000111122223333' \
-H 'cache-control: no-cache' \
-d '{
"amount": "100",
"currency": "BAM",
"source": "ombq-xs1V-peOtHJFDTOJFkxzvOC2F_M537TOxuD",
"order_number": "3ykWPsOyzcdLB1H-vfcuylb7VYhOu3kF",
"order_info": "Order info"
}'
Example - pan token
curl -X POST \
https://mobile.webteh.hr/pgw/api/charge \
-H 'Accept: application/json' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Host: mobile.webteh.hr' \
-H 'User-Agent: PostmanRuntime/7.17.1' \
-H 'auth_token: 00001111222233330000111122223333' \
-H 'cache-control: no-cache' \
-d '{
"amount": "100",
"currency": "BAM",
"source": "cafb28787e42aadcd73a7e92e5e57fa2b504280b40a26e75c00c62ec4c6f0a15",
"order_number": "2YrE66GY-aduQaGnajh2GEN-yWmtKaRX",
"order_info": "Order info",
"email": "[email protected]",
"full_name": "John Smith"
}'
Success Response:
Response is successful if following is satisfied:
Code: 200
Content:
{
"id":195136,
"card_type":"visa",
"pm_alias":null,
"ch_email":"[email protected]",
"ch_full_name":"John doe",
"merchant_id":"007007007007",
"masked_pan":"***-1111",
"amount":1,
"response_code":"0000",
"response_message":"approved",
"approval_code":"638548",
"status":"approved",
"expiry_date":null,
"user_id":null
}
Error Response:
Error response can occur in multiple scenarios as described bellow
- Wrong or missing auth token
- Code:
401 UNAUTHORIZED
- Content:
{
"code":200016,
"error":"Not authorized!",
"library_error":true,
"definite_error":false
}- Invalid input data - missing one of required params, input data validation failed.
- Code:
422 Unprocessable Entity
- Content:
{
"error": "Validation failed",
"errors": {
"code": 200000,
"error": "Field currency is required",
"library_error": true,
"definite_error": true
}
}