API Payments
To integrate VaultsPay payment gateway in your web portal follow below steps.
Prerequisites
Before going ahead just make sure you have completed the following steps and have a few things at your disposal.
API Payments Checlist:
Active Profile
Your merchant account and owner account must be in activate state by the VaultsPay team. Complete your profile by giving all required information in order to get approval. Beware! By providing fallacious documents and information you will be blocked permenantly on VaultsPay.
Privilege Check
For any payment function on VaultsPay you must have the privilege for that operation otherwise you can not perform the operation. By default you will get your privileges according to your package plan.
IP Restriction
If your merchant account is activated for IP Restriction Check then you need to get your server's static IP listed for your account. Any payment request coming from IPs other then allowed ones will be rejected.
If you have completed all above steps then your are good to go.
Getting Access Token
To initiate a transaction on VaultsPay system you need to get an AccessToken
first.
Getting API Keys
You can get your API keys by going to the App Settings section on your dashboard.
Here you can get the client_id
and client_secret
keys.
Access Token API Request:
POST: https://ext-api.vaultspay.com/external/v1/merchant-auth
{
"client_id": "vp_axaxaxaxaxaxaxaxaxax",
"client_secret": "vp_axaxaxaxaxaxaxaxaxaxaxaxa",
}
Access Token API Response:
data |
All response details data is inside data attribute. |
---|---|
access_token |
If the request is validated you will get an access_token which you will use to initiate a transaction. Token expiry will be in seconds . After getting the access_token you have to pass access_token in every API header while requesting. |
{
"message": "Successful.",
"data": {
"access_token": "klpd2lkR0ZuSWpvaUluMD0i.oaMxU6NbFJ9NHyVtWUCF9Bn_HndB2Rt7h4qrMRC2xOI",
"token_expiry": 300,
},
"code": 200
}
Allowed Payment Schemas
Allowed Payment Schemas API Request:
currencyCode |
Required, Currency code in ISO3 format. You can check the list here. |
---|---|
ChannelName |
Required, For example web |
POST: https://ext-api.vaultspay.com/external/v1/get-vaultspay-allowed-payment-methods
{
"currencyCode": "AED",
"channelName": "web,
}
Allowed Payment Schemas API Response:
data |
All response details data is inside data attribute. |
---|---|
name |
name is the schema name assigned to the account. |
code |
code will be used to initiating transactions. |
{
"message": "Successful.",
"data": [
{
"id": 2,
"name": "VISA / MASTER ",
"code": "SCM_02",
"currency": {
"id": 1,
"name": "AED",
"code": "AED"
},
"smart_routing": false
}
],
"code": 200
}
Initiate Payment
Initiate Payment API Request:
amount |
Required |
---|---|
expiryInSeconds |
Required, 0 for life time validity And 1 2 or other will define the time in seconds. |
redirectUrl |
Optional, This will be simple redirect url after payment to your site. |
callBackUrl |
Optional, This will be the hook that you will receive from vaultsPay. |
schemaCode |
Required, Get schema code from Get Allowed Payment Schema Api i-e SCM_00 for single payment schema. To iniatiate transaction in multiple schemas , then send Json string of schema codes i-e ["SCM_00","SCM_001"] |
channelName |
Required, web |
clientReference |
Optional, Reference that can be used to track transaction. |
POST: https://ext-api.vaultspay.com/external/v1/initialize-merchant-payment
{
"amount": 100,
"expiryInSeconds": 0,
"redirectUrl": "https://dummy/v1/redirect-url",
"callBackUrl": "https://dummy/v1/call-back-url",
"schemaCode": "SCM_02",
"channelName": "Web",
"clientReference": "VP-sdfs1245hdh",
}
Initiate Payment API Response:
data |
All response details data is inside data attribute. |
---|---|
paymentUrl |
To complete the payment process user need to redirect to this URL. VaultsPay payment SDK will be open and the user can pay there. |
paymentId |
Payment id is the vaultsPay transaction id. |
{
"message": "Successful.",
"data": {
"paymentUrl": "https://dummy/payment-url",
"paymentId": "AP_ZM40ZDVDPU9PB"
},
"code": 200
}
Payment Status
Payment Status API Request:
transactionId |
This will be vaultsPay transaction id. |
---|
POST: https://ext-api.vaultspay.com/external/v1/get-transaction-details
{
"transactionId": "VPAPI_3A060766C190E912D362",
}
Payment Status API Response:
data |
All response details data is inside data attribute. |
---|
{
"message": "Successful.",
"data": {
"transactionStatus": "PENDING",
"currency": "AED",
"transactionId": "AP_ZM40ZDVDPU9PB",
"transactionTime": "2024-08-20T08:36:11.000000Z",
"transactionAmount": 100,
"transactionVat": 0,
"transactionFee": 0,
"transactionSubTotalAmount": 100,
"countryCode": "",
"customerDetails": {
"name": null,
"email": null,
"phoneNumber": null,
"cardNumber": null,
"cardHolderName": null
}
},
"code": 200
}
Refund
Refund API Request:
transactionId |
AP_t123 |
---|---|
isPartial |
0,1 if 1 amount is required. if full amount to refund both isPartial and amount is optional |
redirectUrl |
This will be simple redirect url after payment to your site. |
amount |
Required only if isPartial=1 |
description |
Optional |
callbackHookUrl |
OPTIONAL. URL for refund hook to update status of refund. |
POST: https://ext-api.vaultspay.com/external/v1/create-refund-request
{
"transactionId": "VPAPI_3A060766C190E912D362",
"isPartial": 1,
"amount": 10,
"description": "refund amount",
"callbackHookUrl": "https://dumy/call-back-hook-url",
}
Refund API Response:
uuid |
This uuid is the refund transaction id. |
---|---|
transaction_id |
This transaction_id is the vaultspay transaction id for which the refund initiated. |
{
"message": "Successful.",
"data": {
"uuid": "RFRQ_C9BDA779-2CF8-4007-BD40-A4807B303449",
"transaction_id": "PL_RRXZN1ZSFYUQZ",
"is_partial": 1,
"amount": "50",
"description": "",
"status":1
"created_at": "2021-09-02T07:01:12.000000Z",
},
"code": 200,
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.ImV5SnBkaUk2SWtvdmRVSnVOakJDVUZkeWNuQXhPRUpuYnpNclkzYzlQU0lzSW5aaGJIVmxJam9pZG5wMlUwNHhla3h0YlVvMk5rUlZOMlJSZDBKdWREZDNPVXhSTlRKd2IwbzRWRmgwVDBkdFRpdE9RMEpGY1RGcEswOUhVWFpTUzBkdGF6WkZlR3BLVjNaM05HMURUMDUyTWt4WFpUTnFaWHB4T1hwSFVXTmlSbkZWY1daSVlURTNjR2xCWkhGbmMyVjRZemxVVWpjck0zaFhkWE52YkdOMk9HdEZkME50UTNwSldIRXlUVzFyVVc1WVVXUXhLeTlXVkVkUVNXdHZTVTFOVlU5SVdqRkpRa013YVRFM1NIRnlUbTVIYUVwSWRFTTBjMVpNYUdaTlQxWkVOMjh3TDJzdmN6aDVURXREZVcxRmVVUkphSFYyVlVoUFV6bDJhRlpqVDFrMWFqZDJTVGhoYm1WUE5uSlBOMnB5TW5wNE5FeEdTMk5RVVU5cU9GSXdaMUV4Wkd4dmFEYzRNWFF5WWs5eVFtaG9RV1pCU21sVWJGSXhXVGN4T1VsV01FRkRhVlZSV0VoUk0yNUJRM0F6SzBvcllYSXZkSG93VUd0VVV6QnlPRlpIWTJwYU9GTk9SbkJVYkN0ak5GSk9lV28zVnpCelZIUlRhR2hSUFQwaUxDSnRZV01pT2lJeU5qbGpPVEk1Wm1WaE9UQXlNV1pqT1dVME4yTmpNMkkzTUdZd1pqSmtaVE5tWVRJNE5UUTBaalF3TURjeFl6TXhaRFJsTlRNMU9XVmpZakpoTVdSaUluMD0i.ArXyY3hGp9gDjQ5629dZTtqkR57-_vAK3sSp4VIUMvs"
}