{
	"info": {
		"_postman_id": "b7278ea9-95c0-4af8-8c65-1d5a8c69d892",
		"name": "Afterpay Online US API v2",
		"description": "Afterpay Online US API V2 - \n\nhttps://docs.afterpay.com.au/online-api-v2-b857508478e7.html#afterpay-online-api-v2",
		"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json",
		"_exporter_id": "10084623"
	},
	"item": [
		{
			"name": "Configuration",
			"item": [
				{
					"name": "Get Config",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "*/*",
								"type": "text"
							}
						],
						"url": "https://api.us-sandbox.afterpay.com/v2/configuration",
						"description": "Retrieves payment configuration that includes payment ranges. A request to create a checkout will be rejected if the total amount is not between (inclusive) the minimumAmount and maximumAmount."
					},
					"response": []
				}
			]
		},
		{
			"name": "Checkouts",
			"item": [
				{
					"name": "Create Checkout",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var jsonData = JSON.parse(responseBody);",
									"postman.setEnvironmentVariable(\"token\", jsonData.token);"
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n         \"amount\": {\n            \"amount\": \"37.00\",\n            \"currency\": \"USD\"\n         },\n         \"consumer\": {\n            \"phoneNumber\": \"2120000000\",\n            \"givenNames\": \"Joe\",\n            \"surname\": \"Consumer\",\n            \"email\": \"test@afterpay.com\"\n         },\n        \"billing\": {\n            \"name\": \"Joe Consumer\",\n            \"line1\": \"1004 Point Lobos Ave\",\n            \"area1\": \"San Francisco\",\n            \"region\": \"CA\",\n            \"postcode\": \"94121\",\n            \"countryCode\": \"US\",\n            \"phoneNumber\": \"2120000000\"\n        },\n        \"shipping\": {\n            \"name\": \"Joe Consumer\",\n            \"line1\": \"1004 Point Lobos Ave\",\n            \"area1\": \"San Francisco\",\n            \"region\": \"CA\",\n            \"postcode\": \"94121\",\n            \"countryCode\": \"US\",\n            \"phoneNumber\": \"2120000000\"\n        },\n        \"items\":[\n            {\n                \"name\": \"Blue Carabiner\",\n                \"sku\": \"12341234\",\n                \"quantity\": 1,\n                \"pageUrl\": \"https://www.example-merchant.afterpay.com/carabiner-354193.html\",\n                \"imageUrl\": \"https://img.example-merchant.afterpay.com/carabiner-7378-391453-1.jpg\",\n                \"price\": {\n                    \"amount\": \"40.00\",\n                    \"currency\": \"USD\"\n                },\n                \"categories\": [\n                            [\"Sporting Goods\", \"Climbing Equipment\", \"Climbing\", \"Climbing Carabiners\"],\n                            [\"Discounts\", \"Climbing\"]\n                ]\n            },\n            {\n             \"name\": \"Jeans\",\n             \"sku\": \"12341235\",\n             \"quantity\": 1,\n             \"pageUrl\": \"https://www.example-merchant.afterpay.com/jeans-354193.html\",\n             \"imageUrl\": \"https://img.example-merchant.afterpay.com/jeans-7378-391453-1.jpg\",\n             \"price\": {\n                 \"amount\": \"20.00\",\n                 \"currency\": \"USD\"\n                }\n            }\n         ],\n         \"discounts\": [\n            {\n                \"displayName\": \"10% Off Subtotal\",\n                \"amount\": {\n                    \"amount\": \"3.00\",\n                    \"currency\": \"USD\"\n                }\n            }\n         ],\n         \"merchant\": {\n            \"redirectConfirmUrl\": \"https://www.example-merchant.afterpay.com/confirm\",\n            \"redirectCancelUrl\": \"https://www.example-merchant.afterpay.com/cancel\"\n         },\n         \"merchantReference\": \"merchant-order-number\",\n         \"taxAmount\": {\n            \"amount\": \"0.00\",\n            \"currency\": \"USD\"\n         },\n         \"shippingAmount\": {\n             \"amount\": \"10.00\",\n             \"currency\": \"USD\"\n         }\n      }"
						},
						"url": "https://api.us-sandbox.afterpay.com/v2/checkouts",
						"description": "This endpoint creates a checkout that is used to initiate the afterpay payment process. Afterpay uses the information in the checkout request to assist with the consumer’s pre-approval process."
					},
					"response": []
				},
				{
					"name": "Get Checkout",
					"event": [
						{
							"listen": "prerequest",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						},
						{
							"listen": "test",
							"script": {
								"exec": [
									"var jsonData = JSON.parse(responseBody);",
									"postman.setEnvironmentVariable(\"merchantReference\", jsonData.merchantReference);"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "*/*"
							}
						],
						"url": "https://api.us-sandbox.afterpay.com/v2/checkouts/{{token}}",
						"description": "Retrieves an individual checkout by token."
					},
					"response": []
				}
			]
		},
		{
			"name": "Payments",
			"item": [
				{
					"name": "Capture (without Auth)",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var jsonData = JSON.parse(responseBody);",
									"postman.setEnvironmentVariable(\"id\", jsonData.id);"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n\t\"token\": \"{{token}}\",\n\t\"merchantReference\": \"merchant-order-number\"\n}"
						},
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/capture",
						"description": "This resource performs a direct payment capture and is the equivalent of capturing a credit card.\n\nThe payment resource is idempotent based on the token. The idempotent nature of the payment resources allows for the safe retry of requests, guaranteeing the operation is only performed once."
					},
					"response": []
				},
				{
					"name": "Auth",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var jsonData = JSON.parse(responseBody);",
									"postman.setEnvironmentVariable(\"id\", jsonData.id);",
									"postman.setEnvironmentVariable(\"merchantReference\", jsonData.merchantReference);"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n\t\"token\": \"{{token}}\",\n\t\"merchantReference\": \"merchant-order-number\"\n}"
						},
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/auth",
						"description": "This resource creates a payment authorisation, to be captured at a later date. The authorisation has an expiration date and time. This is returned in the events list for the AUTHED payment event type.\n\nThe authorisation resource is idempotent based on the token. The idempotent nature of the payment resources allows for the safe retry of requests, guaranteeing the operation is only performed once."
					},
					"response": []
				},
				{
					"name": "Capture Payment",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n         \"requestId\": \"merchant-generated-request-guid\",\n         \"merchantReference\": \"merchant-order-number\",\n         \"amount\" : {\n             \"amount\" : \"37.00\",\n             \"currency\" : \"USD\"\n         }\n     }"
						},
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/{{id}}/capture",
						"description": "This resource performs a capture against an authorisation. Multiple captures can be performed against an authorisation, provided that the sum of captures does not exceed the authorised amount. Once the total amount authorised is captured, the payment state will be updated to “CAPTURED” and no further capture requests will succeed.\n\nThe resource is idempotent if a unique requestId is provided."
					},
					"response": []
				},
				{
					"name": "Void Authorisation",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"type": "text",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": ""
						},
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/{{id}}/void",
						"description": "This resource performs a void against an authorisation. If the authorisation has not been partially captured, calling this will void the entire authorisation. If the payment has been partially captured, then calling void will release the remaining funds to the consumer and complete the payment by marking it “CAPTURED”.\n\nThe resource is idempotent for a payment id."
					},
					"response": []
				},
				{
					"name": "Update Shipping Courier",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									""
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "PUT",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n\t\"shippedAt\": \"2015-01-01T00:00:00Z\",\n\t\"name\": \"CourierPost\",\n\t\"tracking\": \"AA999999999AA\",\n\t\"priority\": \"STANDARD\"\n}"
						},
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/{{id}}/courier",
						"description": "This resource updates a payment with new shipping courier information. The Afterpay customer support team utilise the shipping courier information when enquiring on the outcome of an order."
					},
					"response": []
				},
				{
					"name": "Get Payment by OrderId",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "*/*"
							},
							{
								"key": "Authorization",
								"value": "BasicMTA6ZjRiMTdmNjMxOGY5MGQ3ZTYzYzA0NDI4NzU1MTJhNGVlZmRiMDAwN2MyZjI2ZGExNGNjMDkwMmY1MmUyM2I4MDExOGJjNDc2NzU3YWY3YTlhMzY2NmRkY2NkNmQ4NzI1NDUzOGRhNmQzZjZkZWUxZDk0N2E3MWU5NmE0MzA0NmI="
							}
						],
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/{{id}}",
						"description": "Retrieves an individual payment along with its order details - using the orderId, as the request parameter."
					},
					"response": []
				},
				{
					"name": "Get Payment By Token",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "*/*"
							}
						],
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/token:{{token}}",
						"description": "Retrieves an individual payment along with its order details - using the token, as the request parameter."
					},
					"response": []
				},
				{
					"name": "List Payments",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "*/*"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "https://api.us-sandbox.afterpay.com/v2/payments?merchantReferences=merchant-order-number&ids={{id}}",
							"protocol": "https",
							"host": [
								"api",
								"us-sandbox",
								"afterpay",
								"com"
							],
							"path": [
								"v2",
								"payments"
							],
							"query": [
								{
									"key": "fromCreatedDate",
									"value": "1970-01-01T00:00:00.000Z",
									"disabled": true
								},
								{
									"key": "toCreatedDate",
									"value": "2019-11-11T00:00:00.000Z",
									"disabled": true
								},
								{
									"key": "tokens",
									"value": "ro0ubumh557el6n6pqitjp4c11d9ui77p6mj5i1bgjlep8k8305m",
									"disabled": true
								},
								{
									"key": "merchantReferences",
									"value": "merchant-order-number"
								},
								{
									"key": "statuses",
									"value": "APPROVED",
									"disabled": true
								},
								{
									"key": "offset",
									"value": "1",
									"disabled": true
								},
								{
									"key": "limit",
									"value": "250",
									"disabled": true
								},
								{
									"key": "orderBy",
									"value": "createdAt",
									"disabled": true
								},
								{
									"key": "ascending",
									"value": "false",
									"disabled": true
								},
								{
									"key": "ids",
									"value": "{{id}}"
								}
							]
						},
						"description": "Get a list of payments for the merchant.\n\nTo retrieve a filtered list of payments, the following request parameters can be included:\n\ntokens\n*optional\n*string[]\n*A list of order tokens. Parameter can be used multiple times to search by multiple ids.\n\nids\n*optional\n*string[]\n*Search by Afterpay payment ID. Parameter can be used multiple times to search by multiple IDs.\n\nmerchantReferences\n*optional\n*string[]\n*Search by merchant references. Parameter can be used multiple times to search by multiple merchant references.\n\nMore documentation available at:\nhttps://docs.afterpay.com.au/online-api-v2-b857508478e7.html#list-payments"
					},
					"response": []
				},
				{
					"name": "Create Refund",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"name": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n\t\"requestId\": \"merchant-generated-request-guid\",\n\t\"amount\" : {\n\t\t\"amount\" : \"37.00\",\n\t\t\"currency\" : \"USD\"\n\t\t},\n\t\"merchantReference\" : \"merchant-order-number\"\n}"
						},
						"url": "https://api.us-sandbox.afterpay.com/v2/payments/{{id}}/refund",
						"description": "This resource performs a full or partial refund.\n\nThe resource is idempotent if a unique requestId is provided."
					},
					"response": []
				}
			]
		}
	],
	"auth": {
		"type": "basic",
		"basic": {
			"username": "",
			"password": ""
		}
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "token",
			"value": "",
			"type": "string"
		},
		{
			"key": "id",
			"value": "",
			"type": "string"
		},
		{
			"key": "merchantReference",
			"value": "",
			"type": "string"
		}
	]
}
