Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deer-roy/6dc7fc39c04a99337e715d2321d41fc6 to your computer and use it in GitHub Desktop.
Save deer-roy/6dc7fc39c04a99337e715d2321d41fc6 to your computer and use it in GitHub Desktop.
Sticitt host-to-host api collection
{
"info": {
"_postman_id": "97b1358c-d027-4284-b3d4-ecce3a7e88e7",
"name": "Sticitt Host-to-Host API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "44945686"
},
"item": [
{
"name": "1. Retrieve access token",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var responseJSON = pm.response.json();",
"",
"// Extract access_token and save it to collection variable",
"pm.test(\"Extract access_token and save to collection variable\", function () {",
" pm.collectionVariables.set(\"access_token\", responseJSON.access_token);",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "client_id",
"value": "<client-id>",
"description": "Your private Sticitt client id",
"type": "text"
},
{
"key": "client_secret",
"value": "<client-secret>",
"description": "Your private Sticitt client secret",
"type": "text"
},
{
"key": "grant_type",
"value": "client_credentials",
"type": "text"
},
{
"key": "scope",
"value": "pay-sdk-api",
"type": "text"
}
]
},
"url": {
"raw": "https://iam-test.sticitt.co.za/connect/token",
"protocol": "https",
"host": [
"iam-test",
"sticitt",
"co",
"za"
],
"path": [
"connect",
"token"
]
}
},
"response": []
},
{
"name": "2. Create payment",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var responseJSON = pm.response.json();",
"",
"// Extract access_token and save it to collection variable",
"pm.test(\"Extract access_token and save to collection variable\", function () {",
" pm.collectionVariables.set(\"payment_id\", responseJSON.paymentID);",
"});",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"merchantID\": \"{{merchant_id}}\",\n \"amount\": 100,\n \"reference\": \"<payment-reference>\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://sdk-test.sticitt.co.za/v1/payment",
"protocol": "https",
"host": [
"sdk-test",
"sticitt",
"co",
"za"
],
"path": [
"v1",
"payment"
]
}
},
"response": []
},
{
"name": "Get terminals",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://sdk-test.sticitt.co.za/v1/terminals/{{merchant_id}}",
"protocol": "https",
"host": [
"sdk-test",
"sticitt",
"co",
"za"
],
"path": [
"v1",
"terminals",
"{{merchant_id}}"
],
"query": [
{
"key": "",
"value": null,
"disabled": true
}
]
}
},
"response": []
},
{
"name": "Submit payment to terminal",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"terminalID\": \"<terminal-id>\",\n \"paymentID\": \"{{payment_id}}\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://sdk-test.sticitt.co.za/v1/terminal/submit-payment",
"protocol": "https",
"host": [
"sdk-test",
"sticitt",
"co",
"za"
],
"path": [
"v1",
"terminal",
"submit-payment"
],
"query": [
{
"key": "",
"value": null,
"disabled": true
}
]
}
},
"response": []
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access_token}}",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
}
],
"variable": [
{
"key": "access_token",
"value": "",
"type": "string"
},
{
"key": "merchant_id",
"value": "",
"type": "string"
},
{
"key": "payment_id",
"value": "",
"type": "string"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment