{
	"info": {
		"_postman_id": "6a6ebcb3-cb35-4c32-9199-3ebf055143fb",
		"name": "Payment API Documentation (New)",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "7820111"
	},
	"item": [
		{
			"name": "Client Credentials Grant",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// set the access token",
							"pm.collectionVariables.set('access_token', pm.response.json().access_token);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"value": "application/x-www-form-urlencoded",
						"type": "text"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "client_id",
							"value": "{{client_id}}",
							"type": "text"
						},
						{
							"key": "grant_type",
							"value": "client_credentials",
							"type": "text"
						},
						{
							"key": "client_secret",
							"value": "{{client_secret}}",
							"type": "text"
						},
						{
							"key": "scope",
							"value": "single",
							"type": "text",
							"disabled": true
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/v2/oauth/token",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"oauth",
						"token"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Payment - Page",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// set the access token",
							"pm.collectionVariables.set('page_token', pm.response.json().access_token);",
							"pm.collectionVariables.set('page_pmt_ref_num', pm.response.json().payment_reference);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"type\": \"triplea\",\n    \"merchant_key\": \"{{mcnt_key}}\",\n    \"order_currency\": \"USD\",\n    \"order_amount\": 8,\n    \"payer_id\": \"483490639429\",\n    \"payer_name\": \"Steven Chan\",\n    \"payer_email\": \"steven.chan@triple-a.io\",\n    \"success_url\": \"https://duckduckgo.com\",\n    \"cancel_url\": \"https://yahoo.com\",\n    \"notify_url\": \"https://webhook.site/73219945-9656-4324-bce5-a574c1816e64\",\n    \"notify_secret\": \"Herro123!@#\",\n    \"notify_txs\": true,\n    \"webhook_data\": {\n        \"order_id\": \"ABC12345-2\"\n    },\n    \"cart\": {\n        \"items\": [\n            {\n                \"amount\": 10.99,\n                \"quantity\": 1,\n                \"label\": \"A tale of 2 cities\",\n                \"sku\": \"2736829\"\n            }\n        ],\n        \"shipping_cost\": 2.57,\n        \"shipping_discount\": 0,\n        \"tax_cost\": 0.73\n    },\n    \"sandbox\": true\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v2/payment",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payment"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Payment - Widget",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// set the access token",
							"pm.collectionVariables.set('page_token', pm.response.json().access_token);",
							"pm.collectionVariables.set('page_pmt_ref_num', pm.response.json().payment_reference);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"type\": \"widget\",\n    \"merchant_key\": \"{{mcnt_key}}\",\n    \"order_currency\": \"USD\",\n    \"order_amount\": 10,\n    \"payer_id\": \"steven.chan@triple-a.io\"\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v2/payment",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payment"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Payment With Account",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// set the access token",
							"pm.collectionVariables.set('page_token', pm.response.json().access_token);",
							"pm.collectionVariables.set('page_pmt_ref_num', pm.response.json().payment_reference);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"type\": \"triplea\",\n    \"order_currency\": \"USD\",\n    \"order_amount\": 10,\n    \"payer_id\": \"483490639429\",\n    \"payer_name\": \"Steven Chan\",\n    \"payer_email\": \"steven.chan@triple-a.io\",\n    \"success_url\": \"https://duckduckgo.com\",\n    \"cancel_url\": \"https://yahoo.com\",\n    \"notify_url\": \"https://webhook.site/73219945-9656-4324-bce5-a574c1816e64\",\n    \"notify_secret\": \"Herro123!@#\",\n    \"notify_txs\": true,\n    \"webhook_data\": {\n        \"order_id\": \"ABC12345-2\"\n    },\n    \"cart\": {\n        \"items\": [\n            {\n                \"amount\": 10.99,\n                \"quantity\": 1,\n                \"label\": \"A tale of 2 cities\",\n                \"sku\": \"2736829\"\n            }\n        ],\n        \"shipping_cost\": 2.57,\n        \"shipping_discount\": 0,\n        \"tax_cost\": 0.73\n    }\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v2/payment/account/{{drct_api_id}}",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payment",
						"account",
						"{{drct_api_id}}"
					]
				}
			},
			"response": []
		},
		{
			"name": "Payment Status / Details",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"const res = pm.response.json();",
							"",
							"if (res.required_payer_data && res.required_payer_data.poi) {",
							"    let poi = res.required_payer_data.poi;",
							"    pm.collectionVariables.set('poi_upload_url', poi.url);",
							"    pm.collectionVariables.set('poi_upload_key', poi.fields.key);",
							"    pm.collectionVariables.set('poi_upload_x_amz_alogrithm', poi.fields['X-Amz-Algorithm']);",
							"    pm.collectionVariables.set('poi_upload_x_amz_credential', poi.fields['X-Amz-Credential']);",
							"    pm.collectionVariables.set('poi_upload_x_amz_date', poi.fields['X-Amz-Date']);",
							"    pm.collectionVariables.set('poi_upload_policy', poi.fields.Policy);",
							"    pm.collectionVariables.set('poi_upload_x_amz_signature', poi.fields['X-Amz-Signature']);",
							"}"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{page_token}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/v2/payment/{{page_pmt_ref_num}}?verbose=1",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payment",
						"{{page_pmt_ref_num}}"
					],
					"query": [
						{
							"key": "verbose",
							"value": "1"
						}
					]
				}
			},
			"response": []
		},
		{
			"name": "Balances",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// set the access token",
							"pm.collectionVariables.set('merchant_key', pm.response.json()[0].merchant_key);"
						],
						"type": "text/javascript"
					}
				}
			],
			"protocolProfileBehavior": {
				"disableBodyPruning": true
			},
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v1/payout/balances",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v1",
						"payout",
						"balances"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Refund Local",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// set the access token",
							"pm.collectionVariables.set('l2c_rfnd_pyt_ref_num', pm.response.json().payout_reference);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"payment_reference\": \"{{local_pmt_ref_num}}\",\n    \"email\": \"steven.chan@triple-a.io\",\n    \"refund_amount\": 0.5,\n    \"remarks\": \"some remarks here!\",\n    \"notify_url\": \"https://webhook.site/f1904b4a-18ae-4062-b1b0-f7f61f037423\"\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v1/payout/refund/local",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v1",
						"payout",
						"refund",
						"local"
					]
				}
			},
			"response": []
		},
		{
			"name": "Refund Local Details",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{new_access_token}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/v1/payout/refund/{{l2c_rfnd_pyt_ref_num}}",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v1",
						"payout",
						"refund",
						"{{l2c_rfnd_pyt_ref_num}}"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Withdraw (Local-Crypto)",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"// set the access token",
							"pm.collectionVariables.set('l2c_wdrw_pyt_ref_num', pm.response.json().payout_reference);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"merchant_key\": \"{{merchant_key}}\",\n    \"email\": \"steven.chan@triple-a.io\",\n    \"withdraw_currency\": \"SGD\",\n    \"withdraw_amount\": 3.00,\n    \"crypto_currency\": \"testBTC\",\n    \"remarks\": \"some remarks here!\",\n    \"notify_url\": \"https://webhook.site/a423876c-b890-4503-8bf4-82c208e2bbd5\",\n    \"notify_secret\": \"hello123!\"\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v1/payout/withdraw/local/crypto",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v1",
						"payout",
						"withdraw",
						"local",
						"crypto"
					]
				}
			},
			"response": []
		},
		{
			"name": "Withdraw Details (Local-Crypto)",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{wthdrw_access_token}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/v1/payout/withdraw/{{l2c_wdrw_pyt_ref_num}}",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v1",
						"payout",
						"withdraw",
						"{{l2c_wdrw_pyt_ref_num}}"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Direct Withdraw (Local-Crypto)",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"let res = pm.response.json();",
							"",
							"pm.collectionVariables.set('drct_l2c_wdrw_prn', res.payout_reference);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"merchant_key\": \"{{merchant_key}}\",\n    \"email\": \"steven.chan@triple-a.io\",\n    \"withdraw_currency\": \"USD\",\n    \"withdraw_amount\": 12,\n    \"crypto_currency\": \"testBTC\",\n    \"remarks\": \"some remarks here!\",\n    \"notify_url\": \"https://webhook.site/bbd02a54-5524-4620-aa88-bb8214271d2f\",\n    \"notify_secret\": \"hello123!\",\n    \"address\": \"mtzozhx2H1AX8K1gfGPyHDxZ18Ggcvvhbf\"\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v2/payout/withdraw/local/crypto/direct",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payout",
						"withdraw",
						"local",
						"crypto",
						"direct"
					]
				}
			},
			"response": []
		},
		{
			"name": "Direct Withdraw Refresh (Local-Crypto)-DEPRECATED",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v2/payout/withdraw/{{drct_l2c_wdrw_prn}}/local/crypto/refresh",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payout",
						"withdraw",
						"{{drct_l2c_wdrw_prn}}",
						"local",
						"crypto",
						"refresh"
					]
				}
			},
			"response": []
		},
		{
			"name": "Direct Withdraw Confirm (Local-Crypto)",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v2/payout/withdraw/{{drct_l2c_wdrw_prn}}/local/crypto/confirm",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payout",
						"withdraw",
						"{{drct_l2c_wdrw_prn}}",
						"local",
						"crypto",
						"confirm"
					]
				}
			},
			"response": []
		},
		{
			"name": "Direct Withdraw Cancel (Local-Crypto)",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{access_token}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/v2/payout/withdraw/{{drct_l2c_wdrw_prn}}/local/crypto/cancel",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"v2",
						"payout",
						"withdraw",
						"{{drct_l2c_wdrw_prn}}",
						"local",
						"crypto",
						"cancel"
					]
				}
			},
			"response": []
		},
		{
			"name": "Get Exchange Rate",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "https://api.triple-a.io/api/v1/exchange_rate/{{drct_api_id}}/BTC/USD",
					"protocol": "https",
					"host": [
						"api",
						"triple-a",
						"io"
					],
					"path": [
						"api",
						"v1",
						"exchange_rate",
						"{{drct_api_id}}",
						"BTC",
						"USD"
					]
				}
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "https://api.triple-a.io"
		},
		{
			"key": "mcnt_key",
			"value": ""
		},
		{
			"key": "client_id",
			"value": ""
		},
		{
			"key": "client_secret",
			"value": ""
		},
		{
			"key": "access_token",
			"value": ""
		},
		{
			"key": "drct_api_id",
			"value": ""
		},
		{
			"key": "page_token",
			"value": ""
		},
		{
			"key": "page_pmt_ref_num",
			"value": ""
		},
		{
			"key": "page_btc_api_id",
			"value": ""
		},
		{
			"key": "page_eth_api_id",
			"value": ""
		},
		{
			"key": "page_tbtc_api_id",
			"value": ""
		},
		{
			"key": "poi_upload_url",
			"value": ""
		},
		{
			"key": "poi_upload_key",
			"value": ""
		},
		{
			"key": "poi_upload_x_amz_alogrithm",
			"value": ""
		},
		{
			"key": "poi_upload_x_amz_credential",
			"value": ""
		},
		{
			"key": "poi_upload_x_amz_date",
			"value": ""
		},
		{
			"key": "poi_upload_policy",
			"value": ""
		},
		{
			"key": "poi_upload_x_amz_signature",
			"value": ""
		},
		{
			"key": "invc_url",
			"value": ""
		},
		{
			"key": "auth_user",
			"value": ""
		},
		{
			"key": "auth_pass",
			"value": ""
		},
		{
			"key": "auth_str",
			"value": ""
		},
		{
			"key": "page_usdt_api_id",
			"value": ""
		},
		{
			"key": "eth_crypto_addr",
			"value": ""
		},
		{
			"key": "eth_tx_hash",
			"value": ""
		},
		{
			"key": "btc_crypto_addr",
			"value": ""
		},
		{
			"key": "tbtc_crypto_addr",
			"value": ""
		},
		{
			"key": "local_pmt_ref_num",
			"value": ""
		},
		{
			"key": "l2c_rfnd_pyt_ref_num",
			"value": ""
		},
		{
			"key": "l2c_wdrw_pyt_ref_num",
			"value": ""
		},
		{
			"key": "drct_l2c_wdrw_prn",
			"value": ""
		}
	]
}