{
	"info": {
		"_postman_id": "d5323a19-9d2f-41c0-9569-32f4b216f706",
		"name": "eCommerce API v2 - Collection",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "QR",
			"item": [
				{
					"name": "Generate QR Code PNG",
					"protocolProfileBehavior": {
						"disabledSystemHeaders": {}
					},
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							},
							{
								"key": "Ocp-Apim-Subscription-Key",
								"value": "{{Ocp-Apim-Subscription-Key}}",
								"type": "text"
							},
							{
								"key": "Merchant-Serial-Number",
								"value": "{{merchantSerialNumber}}",
								"type": "text"
							},
							{
								"key": "Accept",
								"value": "image/png",
								"type": "text"
							},
							{
								"key": "Vipps-System-Name",
								"value": "{{vipps_system_name}}",
								"type": "text"
							},
							{
								"key": "Vipps-System-Version",
								"value": "{{vipps_system_version}}",
								"type": "text"
							},
							{
								"key": "Vipps-System-Plugin-Name",
								"value": "{{vipps_system_plugin_name}}",
								"type": "default"
							},
							{
								"key": "Vipps-System-Plugin-Version",
								"value": "{{vipps_system_plugin_version}}",
								"type": "default"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"url\": \"{{LandingPageURL}}\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/qr/v1",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"qr",
								"v1"
							]
						}
					},
					"response": []
				}
			]
		},
		{
			"name": "Get Access Token",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.environment.set(\"access_token\", pm.response.json().access_token);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "client_id",
						"value": "{{client_id}}"
					},
					{
						"key": "client_secret",
						"value": "{{client_secret}}"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "default"
					}
				],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "{{base_url}}/accessToken/get",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"accessToken",
						"get"
					]
				}
			},
			"response": []
		},
		{
			"name": "Initiate Payment",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							"pm.environment.set('orderId',pm.environment.get('merchantSerialNumber') + (new Date()).getTime());"
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							"if(pm.response.code === 200) { ",
							"    var jsonData = pm.response.json();",
							"    pm.environment.set('LandingPageURL', jsonData.url);",
							"    var str = jsonData.url",
							"    var str2 = str.split('=', 3)[2]",
							"    pm.environment.set('payment_token', str2);",
							"}"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"merchantInfo\": {\n    \"authToken\": \"{{$guid}}\",\n    \"callbackPrefix\":\"{{callbackPrefix}}\",\n    \"fallBack\": \"{{fallBack}}\",\n    \"merchantSerialNumber\": \"{{merchantSerialNumber}}\"\n  },\n  \"customerInfo\": {\n    \"mobileNumber\": \"{{mobileNumber}}\"\n  },\n  \"transaction\": {\n    \"amount\": {{amount}},\n    \"orderId\": \"{{orderId}}\",\n    \"transactionText\": \"{{transactionTextInitiate}}\",\n    \"skipLandingPage\": false\n}\n}"
				},
				"url": {
					"raw": "{{base_url}}/ecomm/v2/payments/",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"payments",
						""
					]
				},
				"description": "This is the default, simple initiate request."
			},
			"response": []
		},
		{
			"name": "Initiate Payment - Express",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							"pm.environment.set('orderId',pm.environment.get('merchantSerialNumber') + (new Date()).getTime());"
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							"if(pm.response.code === 200) { ",
							"    var jsonData = pm.response.json();",
							"    pm.environment.set('LandingPageURL', jsonData.url);",
							"    var str = jsonData.url",
							"    var str2 = str.split('=', 3)[2]",
							"    pm.environment.set('payment_token', str2);",
							"}"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n  \"merchantInfo\": {\r\n    \"authToken\": \"{{$guid}}\",\r\n    \"callbackPrefix\":\"{{callbackPrefix}}\",\r\n    \"consentRemovalPrefix\": \"{{consentRemovalPrefix}}\",\r\n    \"fallBack\": \"{{fallBack}}\",\r\n    \"merchantSerialNumber\": \"{{merchantSerialNumber}}\",\r\n    \"paymentType\": \"eComm Express Payment\",\r\n    \"shippingDetailsPrefix\": \"{{shippingDetailsPrefix}}\",\r\n    \"staticShippingDetails\": [\r\n\t\t{\r\n\t\t    \"isDefault\": \"Y\",\r\n\t\t    \"priority\": 1,\r\n\t\t    \"shippingCost\": {{shippingCost1}},\r\n\t\t    \"shippingMethod\": \"{{shippingMethod1}}\",\r\n\t\t    \"shippingMethodId\": \"shippingMethodId1\"\r\n\t\t},\r\n\t\t{\r\n\t\t    \"isDefault\": \"N\",\r\n\t\t    \"priority\": 2,\r\n\t\t    \"shippingCost\": {{shippingCost2}},\r\n\t\t    \"shippingMethod\": \"{{shippingMethod2}}\",\r\n\t\t    \"shippingMethodId\": \"shippingMethodId2\"\r\n\t\t}\r\n\t]\r\n  },\r\n  \"customerInfo\": {\r\n    \"mobileNumber\": \"{{mobileNumber}}\"\r\n  },\r\n  \"transaction\": {\r\n    \"amount\": {{amount}},\r\n    \"orderId\": \"{{orderId}}\",\r\n    \"transactionText\": \"{{transactionTextInitiate}}\"\r\n  }\r\n}"
				},
				"url": {
					"raw": "{{base_url}}/ecomm/v2/payments/",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"payments",
						""
					]
				},
				"description": "An express payment that provides shipping information.\nIf the end user has not already consented to sharing information to the merchant, they will be asked for any remaining consents before completing the payment flow."
			},
			"response": []
		},
		{
			"name": "Initiate Payment - Profile flow",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							"pm.environment.set('orderId',pm.environment.get('merchantSerialNumber') + (new Date()).getTime());"
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							"if(pm.response.code === 200) { ",
							"    var jsonData = pm.response.json();",
							"    pm.environment.set('LandingPageURL', jsonData.url);",
							"    var str = jsonData.url",
							"    var str2 = str.split('=', 3)[2]",
							"    pm.environment.set('payment_token', str2);",
							"}"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"type": "text",
						"value": "{{merchantSerialNumber}}"
					},
					{
						"key": "Vipps-System-Name",
						"type": "text",
						"value": "{{vipps_system_name}}"
					},
					{
						"key": "Vipps-System-Version",
						"type": "text",
						"value": "{{vipps_system_version}}"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"type": "text",
						"value": "{{vipps_system_plugin_name}}"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"type": "text",
						"value": "{{vipps_system_plugin_version}}"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"merchantInfo\": {\n    \"authToken\": \"{{$guid}}\",\n    \"callbackPrefix\":\"{{callbackPrefix}}\",\n    \"fallBack\": \"{{fallBack}}\",\n    \"merchantSerialNumber\": \"{{merchantSerialNumber}}\"\n  },\n  \"customerInfo\": {\n    \"mobileNumber\": \"{{mobileNumber}}\"\n  },\n  \"transaction\": {\n    \"amount\": {{amount}},\n    \"orderId\": \"{{orderId}}\",\n    \"transactionText\": \"{{transactionTextInitiate}}\",\n    \"skipLandingPage\": false,\n    \"scope\": \"address name email birthDate phoneNumber\"\n}\n}"
				},
				"url": {
					"raw": "{{base_url}}/ecomm/v2/payments/",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"payments",
						""
					]
				},
				"description": "A payment that enables the possibility to fetch profile information for a user.\n\nIf the user has not already consented to sharing information to the merchant, they will be asked for any remaining consents before completing the payment flow."
			},
			"response": []
		},
		{
			"name": "Get Payment Details",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"var jsonData = JSON.parse(responseBody);",
							"postman.setEnvironmentVariable(\"sub\", jsonData.sub);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{base_url}}/ecomm/v2/payments/{{orderId}}/details",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"payments",
						"{{orderId}}",
						"details"
					]
				}
			},
			"response": []
		},
		{
			"name": "Cancel Payment",
			"request": {
				"method": "PUT",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"merchantInfo\": {\r\n        \"merchantSerialNumber\": \"{{merchantSerialNumber}}\"\r\n    },\r\n    \"transaction\": {\r\n        \"transactionText\":\"{{transactionTextCancel}}\"\r\n    }\r\n}"
				},
				"url": {
					"raw": "{{base_url}}/ecomm/v2/payments/{{orderId}}/cancel",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"payments",
						"{{orderId}}",
						"cancel"
					]
				}
			},
			"response": []
		},
		{
			"name": "Capture Payment",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "X-Request-Id",
						"value": "{{orderId}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": " {\n    \"merchantInfo\": {\n        \"merchantSerialNumber\": \"{{merchantSerialNumber}}\"\n    },\n    \"transaction\": {\n        \"transactionText\": \"{{transactionTextCapture}}\"\n    }\n }"
				},
				"url": {
					"raw": "{{base_url}}/ecomm/v2/payments/{{orderId}}/capture",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"payments",
						"{{orderId}}",
						"capture"
					]
				}
			},
			"response": []
		},
		{
			"name": "Force Approve Payment",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "X-Request-Id",
						"value": "{{orderId}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"customerPhoneNumber\": \"{{mobileNumber}}\",\n  \"token\": \"{{payment_token}}\"\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/ecomm/v2/integration-test/payments/{{orderId}}/approve",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"integration-test",
						"payments",
						"{{orderId}}",
						"approve"
					]
				},
				"description": "This endpoint lets developers approve a payment through the eCom API without the use of the Vipps app. This is useful for automated testing. Express is not supported for this endpoint. The endpoint is only available in our Test environment. Attempted use of the endpoint in production is not allowed, and will fail. Important: All test users must manually approve at least one payment in Vipps MobilePay (using the app) before this endpoint can be used for that user."
			},
			"response": []
		},
		{
			"name": "Refund Payment",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					},
					{
						"key": "Ocp-Apim-Subscription-Key",
						"value": "{{Ocp-Apim-Subscription-Key}}"
					},
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "X-Request-Id",
						"value": "{{orderId}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "text"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"merchantInfo\": {\r\n        \"merchantSerialNumber\": \"{{merchantSerialNumber}}\"\r\n    },\r\n    \"transaction\": {\r\n        \"transactionText\":\"{{transactionTextRefund}}\"\r\n    }\r\n}"
				},
				"url": {
					"raw": "{{base_url}}/ecomm/v2/payments/{{orderId}}/refund",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"ecomm",
						"v2",
						"payments",
						"{{orderId}}",
						"refund"
					]
				}
			},
			"response": []
		},
		{
			"name": "Get Userinfo",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"type": "text",
						"value": "Bearer {{access_token}}"
					},
					{
						"key": "Merchant-Serial-Number",
						"value": "{{merchantSerialNumber}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Name",
						"value": "{{vipps_system_name}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Version",
						"value": "{{vipps_system_version}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Plugin-Name",
						"value": "{{vipps_system_plugin_name}}",
						"type": "default"
					},
					{
						"key": "Vipps-System-Plugin-Version",
						"value": "{{vipps_system_plugin_version}}",
						"type": "default"
					}
				],
				"url": {
					"raw": "{{base_url}}/vipps-userinfo-api/userinfo/{{sub}}",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"vipps-userinfo-api",
						"userinfo",
						"{{sub}}"
					]
				}
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "collection_version",
			"value": "2022-05-10"
		}
	]
}
