Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
chore(postman): update Postman collection files
github-actions88627463eacd
diff --git a/postman/collection-json/nmi.postman_collection.json b/postman/collection-json/nmi.postman_collection.jsonindex f09c6bfc1b..3458081d48 100644--- a/postman/collection-json/nmi.postman_collection.json+++ b/postman/collection-json/nmi.postman_collection.json@@ -86,6 +86,15 @@{"name": "Merchant Account - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {@@ -150,15 +159,6 @@],"type": "text/javascript"}- },- {- "listen": "prerequest",- "script": {- "exec": [- ""- ],- "type": "text/javascript"- }}],"request": {@@ -327,6 +327,15 @@{"name": "Payment Connector - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {@@ -374,15 +383,6 @@],"type": "text/javascript"}- },- {- "listen": "prerequest",- "script": {- "exec": [- ""- ],- "type": "text/javascript"- }}],"request": {@@ -424,7 +424,7 @@"language": "json"}},- "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"nmi\",\"connector_account_details\":{\"auth_type\":\"HeaderKey\",\"api_key\":\"{{connector_api_key}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"debit\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"apple_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"google_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}]}"+ "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"nmi\",\"connector_account_details\":{\"auth_type\":\"BodyKey\",\"api_key\":\"{{connector_api_key}}\",\"key1\":\"{{connector_key1}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"debit\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"apple_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"google_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}]}"},"url": {"raw": "{{baseUrl}}/account/:account_id/connectors",@@ -451,6 +451,16 @@{"name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {@@ -525,16 +535,6 @@],"type": "text/javascript"}- },- {- "listen": "prerequest",- "script": {- "exec": [- "pm.environment.set(\"random_number\", _.random(1000, 100000));",- ""- ],- "type": "text/javascript"- }}],"request": {@@ -551,12 +551,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+1\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -652,6 +652,15 @@{"name": "Refunds - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {@@ -709,12 +718,12 @@],"body": {"mode": "raw",- "raw": "{\n \"payment_id\": \"{{payment_id}}\",\n \"amount\": {{amount}},\n \"reason\": \"Customer returned product\",\n \"refund_type\": \"instant\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/refunds",@@ -813,17 +822,25 @@"name": "Happy Cases","item": [{- "name": "Scenario1-Create payment with confirm true",+ "name": "Scenario10-Create a mandate and recurring payment","item": [{"name": "Payments - Create","event": [{- "listen": "test",+ "listen": "prerequest","script": {"exec": ["pm.environment.set(\"random_number\", _.random(100, 100000));",- "",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": ["// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -886,7 +903,7 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"processing\" for \"status\"","if (jsonData?.status) {"," pm.test("," \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",@@ -895,6 +912,22 @@" },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -915,12 +948,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":100000,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -1013,6 +1046,22 @@" },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -1053,21 +1102,24 @@"description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []- }- ]- },- {- "name": "Scenario2-Create payment with confirm false",- "item": [+ },{- "name": "Payments - Create",+ "name": "Recurring Payments - Create","event": [{- "listen": "test",+ "listen": "prerequest","script": {"exec": ["pm.environment.set(\"random_number\", _.random(100, 100000));",- "",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": ["// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -1130,15 +1182,39 @@" );","}","",- "// Response body should have value \"requires_confirmation\" for \"status\"",+ "// Response body should have value \"processing\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"payment_method_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'payment_method_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.payment_method_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -1159,12 +1235,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my last payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -1180,29 +1256,26 @@"response": []},{- "name": "Payments - Confirm",+ "name": "Payments - Retrieve-copy","event": [{"listen": "test","script": {"exec": ["// Validate status 2xx",- "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(",- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",- " function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- " },",- ");",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -1251,15 +1324,31 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"processing\");",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -1267,55 +1356,27 @@}],"request": {- "auth": {- "type": "apikey",- "apikey": [- {- "key": "value",- "value": "{{publishable_key}}",- "type": "string"- },- {- "key": "key",- "value": "api-key",- "type": "string"- },- {- "key": "in",- "value": "header",- "type": "string"- }- ]- },- "method": "POST",+ "method": "GET","header": [- {- "key": "Content-Type",- "value": "application/json"- },{"key": "Accept","value": "application/json"}],- "body": {- "mode": "raw",- "options": {- "raw": {- "language": "json"- }- },- "raw": "{\"client_secret\":\"{{client_secret}}\"}"- },"url": {- "raw": "{{baseUrl}}/payments/:id/confirm",+ "raw": "{{baseUrl}}/payments/:id?force_sync=true","host": ["{{baseUrl}}"],"path": ["payments",- ":id",- "confirm"+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }],"variable": [{@@ -1325,31 +1386,49 @@}]},- "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []- },+ }+ ]+ },+ {+ "name": "Scenario11-Refund recurring payment",+ "item": [{- "name": "Payments - Retrieve",+ "name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "","// Validate status 2xx",- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","","// Validate if response has JSON Body",- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -1398,15 +1477,31 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"processing\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -1414,68 +1509,60 @@}],"request": {- "method": "GET",+ "method": "POST","header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },{"key": "Accept","value": "application/json"}],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":100000,\"currency\":\"USD\"}}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },"url": {- "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "payments",- ":id"- ],- "query": [- {- "key": "force_sync",- "value": "true"- }- ],- "variable": [- {- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"- }+ "payments"]},- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []- }- ]- },- {- "name": "Scenario3-Create payment without PMD",- "item": [+ },{- "name": "Payments - Create",+ "name": "Payments - Retrieve","event": [{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",- "","// Validate status 2xx",- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -1524,15 +1611,31 @@" );","}","",- "// Response body should have value \"requires_payment_method\" for \"status\"",+ "// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -1540,63 +1643,74 @@}],"request": {- "method": "POST",+ "method": "GET","header": [- {- "key": "Content-Type",- "value": "application/json"- },{"key": "Accept","value": "application/json"}],- "body": {- "mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",- "options": {- "raw": {- "language": "json"- }- }- },"url": {- "raw": "{{baseUrl}}/payments",+ "raw": "{{baseUrl}}/payments/:id?force_sync=true","host": ["{{baseUrl}}"],"path": [- "payments"+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }]},- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []},{- "name": "Payments - Confirm",+ "name": "Recurring Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "","// Validate status 2xx",- "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(",- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",- " function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- " },",- ");",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -1645,15 +1759,39 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"processing\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments:id/confirm - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\","," function () {"," pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"payment_method_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'payment_method_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.payment_method_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -1661,26 +1799,6 @@}],"request": {- "auth": {- "type": "apikey",- "apikey": [- {- "key": "value",- "value": "{{publishable_key}}",- "type": "string"- },- {- "key": "key",- "value": "api-key",- "type": "string"- },- {- "key": "in",- "value": "header",- "type": "string"- }- ]- },"method": "POST","header": [{@@ -1699,32 +1817,23 @@"language": "json"}},- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}}}"+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {- "raw": "{{baseUrl}}/payments/:id/confirm",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "payments",- ":id",- "confirm"- ],- "variable": [- {- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"- }+ "payments"]},- "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []},{- "name": "Payments - Retrieve",+ "name": "Payments - Retrieve-copy","event": [{"listen": "test",@@ -1792,15 +1901,31 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\","," function () {"," pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -1841,90 +1966,73 @@"description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []- }- ]- },- {- "name": "Scenario4-Create payment with Manual capture",- "item": [+ },{- "name": "Payments - Create",+ "name": "Refunds - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",- "pm.environment.set(\"amount\", pm.response.json().amount);",+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");","","// Validate status 2xx",- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","",- "// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",- " pm.response.to.have.jsonBody();",- "});",- "","// Set response object as internal variable","let jsonData = {};","try {"," jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",- "if (jsonData?.payment_id) {",- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);"," console.log(",- " \"- use {{payment_id}} as collection variable for value\",",- " jsonData.payment_id,",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\","," );","}","",- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",- "if (jsonData?.mandate_id) {",- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",- " console.log(",- " \"- use {{mandate_id}} as collection variable for value\",",- " jsonData.mandate_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",- " );",- "}",- "",- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",- "if (jsonData?.client_secret) {",- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",- " console.log(",- " \"- use {{client_secret}} as collection variable for value\",",- " jsonData.client_secret,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ "// Response body should have value \"pending\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"pending\");",+ " },"," );","}","",- "// Response body should have value \"requires_capture\" for \"status\"",+ "// Response body should have value for \"amount\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"processing\");",+ " pm.expect(jsonData.amount).to.eql(amount);"," },"," );","}",@@ -1948,101 +2056,92 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"manual\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {- "raw": "{{baseUrl}}/payments",+ "raw": "{{baseUrl}}/refunds","host": ["{{baseUrl}}"],"path": [- "payments"+ "refunds"]},- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ "description": "To create a refund against an already processed payment"},"response": []},{- "name": "Payments - Retrieve",+ "name": "Refunds - Retrieve","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [+ "// Get the value of 'amount' from the environment",+ "const refund_amount = pm.environment.get(\"amount\");",+ "","// Validate status 2xx",- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","",- "// Validate if response has JSON Body",- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",- " pm.response.to.have.jsonBody();",- "});",- "","// Set response object as internal variable","let jsonData = {};","try {"," jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",- "if (jsonData?.payment_id) {",- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",- " console.log(",- " \"- use {{payment_id}} as collection variable for value\",",- " jsonData.payment_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",- " );",- "}",- "",- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",- "if (jsonData?.mandate_id) {",- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);"," console.log(",- " \"- use {{mandate_id}} as collection variable for value\",",- " jsonData.mandate_id,",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\","," );","}","",- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",- "if (jsonData?.client_secret) {",- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",- " console.log(",- " \"- use {{client_secret}} as collection variable for value\",",- " jsonData.client_secret,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },"," );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value for \"refund_amount\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",+ " \"[POST]::/refunds - Content check if value for 'refund_amount' matches '{{refund_amount}}'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ " pm.expect(jsonData.amount).to.eql(refund_amount);"," },"," );","}",@@ -2061,59 +2160,62 @@}],"url": {- "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "raw": "{{baseUrl}}/refunds/:id","host": ["{{baseUrl}}"],"path": [- "payments",+ "refunds",":id"],- "query": [- {- "key": "force_sync",- "value": "true"- }- ],"variable": [{"key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"+ "value": "{{refund_id}}",+ "description": "(Required) unique refund id"}]},- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []- },+ }+ ]+ },+ {+ "name": "Scenario1-Create payment with confirm true",+ "item": [{- "name": "Payments - Capture",+ "name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "// Get the value of 'amount' from the environment",- "const amount = pm.environment.get(\"amount\");",- "","// Validate status 2xx",- "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(",- " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",- " function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- " },",- ");",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -2165,32 +2267,12 @@"// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\","," function () {"," pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",- "",- "// Response body should have value \"{{amount}}\" for \"amount\"",- "if (jsonData?.amount) {",- " pm.test(",- " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",- " function () {",- " pm.expect(jsonData.amount).to.eql(amount);",- " },",- " );",- "}",- "",- "// Response body should have value \"{{amount}}\" for \"amount_received\"",- "if (jsonData?.amount_received) {",- " pm.test(",- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",- " function () {",- " pm.expect(jsonData.amount_received).to.eql(amount);",- " },",- " );",- "}",""],"type": "text/javascript"@@ -2211,37 +2293,28 @@],"body": {"mode": "raw",- "raw": "{\n \"amount_to_capture\": {{amount}},\n \"statement_descriptor_name\": \"Joseph\",\n \"statement_descriptor_suffix\": \"JS\"\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {- "raw": "{{baseUrl}}/payments/:id/capture",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "payments",- ":id",- "capture"- ],- "variable": [- {- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"- }+ "payments"]},- "description": "To capture the funds for an uncaptured payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []},{- "name": "Payments - Retrieve-copy",+ "name": "Payments - Retrieve","event": [{"listen": "test",@@ -2309,10 +2382,10 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\","," function () {"," pm.expect(jsonData.status).to.eql(\"succeeded\");"," },",@@ -2362,17 +2435,25 @@]},{- "name": "Scenario5-Void the payment",+ "name": "Scenario2-Create payment with confirm false","item": [{"name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",- "","// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -2435,12 +2516,12 @@" );","}","",- "// Response body should have value \"requires_capture\" for \"status\"",+ "// Response body should have value \"requires_confirmation\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"processing\");",+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");"," },"," );","}",@@ -2464,12 +2545,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"manual\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my last payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -2485,26 +2566,29 @@"response": []},{- "name": "Payments - Retrieve",+ "name": "Payments - Confirm","event": [{"listen": "test","script": {"exec": ["// Validate status 2xx",- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- "});",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");","","// Validate if response has JSON Body",- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -2553,12 +2637,12 @@" );","}","",- "// Response body should have value \"cancelled\" for \"status\"",+ "// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'\",",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",@@ -2569,115 +2653,26 @@}],"request": {- "method": "GET",- "header": [- {- "key": "Accept",- "value": "application/json"- }- ],- "url": {- "raw": "{{baseUrl}}/payments/:id?force_sync=true",- "host": [- "{{baseUrl}}"- ],- "path": [- "payments",- ":id"- ],- "query": [+ "auth": {+ "type": "apikey",+ "apikey": [{- "key": "force_sync",- "value": "true"- }- ],- "variable": [+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },{- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"}]},- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"- },- "response": []- },- {- "name": "Payments - Cancel",- "event": [- {- "listen": "test",- "script": {- "exec": [- "// Validate status 2xx",- "pm.test(\"[POST]::/payments/:id/cancel - Status code is 2xx\", function () {",- " pm.response.to.be.success;",- "});",- "",- "// Validate if response header has matching content-type",- "pm.test(",- " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",- " function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- " },",- ");",- "",- "// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",- " pm.response.to.have.jsonBody();",- "});",- "",- "// Set response object as internal variable",- "let jsonData = {};",- "try {",- " jsonData = pm.response.json();",- "} catch (e) {}",- "",- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",- "if (jsonData?.payment_id) {",- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",- " console.log(",- " \"- use {{payment_id}} as collection variable for value\",",- " jsonData.payment_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",- " );",- "}",- "",- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",- "if (jsonData?.client_secret) {",- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",- " console.log(",- " \"- use {{client_secret}} as collection variable for value\",",- " jsonData.client_secret,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",- " );",- "}",- "",- "// Response body should have value \"cancelled\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"processing\");",- " },",- " );",- "}",- ""- ],- "type": "text/javascript"- }- }- ],- "request": {"method": "POST","header": [{@@ -2696,17 +2691,17 @@"language": "json"}},- "raw": "{\"cancellation_reason\":\"user_cancel\"}"+ "raw": "{\"client_secret\":\"{{client_secret}}\"}"},"url": {- "raw": "{{baseUrl}}/payments/:id/cancel",+ "raw": "{{baseUrl}}/payments/:id/confirm","host": ["{{baseUrl}}"],"path": ["payments",":id",- "cancel"+ "confirm"],"variable": [{@@ -2716,12 +2711,12 @@}]},- "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"},"response": []},{- "name": "Payments - Retrieve-copy",+ "name": "Payments - Retrieve","event": [{"listen": "test",@@ -2789,12 +2784,12 @@" );","}","",- "// Response body should have value \"cancelled\" for \"status\"",+ "// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'cancelled'\",",+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"cancelled\");",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",@@ -2842,19 +2837,25 @@]},{- "name": "Scenario9-Refund full payment",+ "name": "Scenario2a-Create payment with confirm false card holder name null","item": [{"name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",- "// Set the environment variable 'amount' with the value from the response",- "pm.environment.set(\"amount\", pm.response.json().amount);",- "","// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -2917,12 +2918,12 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"requires_payment_method\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"processing\");",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");"," },"," );","}",@@ -2946,12 +2947,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -2967,26 +2968,38 @@"response": []},{- "name": "Payments - Retrieve",+ "name": "Payments - Confirm","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": ["// Validate status 2xx",- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- "});",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");","","// Validate if response has JSON Body",- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -3035,12 +3048,12 @@" );","}","",- "// Response body should have value \"Succeeded\" for \"status\"",+ "// Response body should have value \"processing\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",@@ -3051,27 +3064,55 @@}],"request": {- "method": "GET",+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },+ "method": "POST","header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },{"key": "Accept","value": "application/json"}],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":null,\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"+ },"url": {- "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "raw": "{{baseUrl}}/payments/:id/confirm","host": ["{{baseUrl}}"],"path": ["payments",- ":id"- ],- "query": [- {- "key": "force_sync",- "value": "true"- }+ ":id",+ "confirm"],"variable": [{@@ -3081,67 +3122,85 @@}]},- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"},"response": []},{- "name": "Refunds - Create",+ "name": "Payments - Retrieve","event": [{"listen": "test","script": {"exec": [- "// Get the value of 'amount' from the environment",- "const amount = pm.environment.get(\"amount\");",- "","// Validate status 2xx",- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "","// Set response object as internal variable","let jsonData = {};","try {"," jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",- "if (jsonData?.refund_id) {",- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);"," console.log(",- " \"- use {{refund_id}} as collection variable for value\",",- " jsonData.refund_id,",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\","," );","}","",- "// Response body should have value \"succeeded\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"pending\");",- " },",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\","," );","}","",- "// Response body should have value \"6540\" for \"amount\"",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.amount).to.eql(amount);",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",@@ -3152,96 +3211,130 @@}],"request": {- "method": "POST",+ "method": "GET","header": [- {- "key": "Content-Type",- "value": "application/json"- },{"key": "Accept","value": "application/json"}],- "body": {- "mode": "raw",- "raw": "{\n \"payment_id\": \"{{payment_id}}\",\n \"amount\": {{amount}},\n \"reason\": \"Customer returned product\",\n \"refund_type\": \"instant\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",- "options": {- "raw": {- "language": "json"- }- }- },"url": {- "raw": "{{baseUrl}}/refunds",+ "raw": "{{baseUrl}}/payments/:id?force_sync=true","host": ["{{baseUrl}}"],"path": [- "refunds"+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }]},- "description": "To create a refund against an already processed payment"+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []- },+ }+ ]+ },+ {+ "name": "Scenario2b-Create payment with confirm false card holder name empty",+ "item": [{- "name": "Refunds - Retrieve",+ "name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "// Get the value of 'amount' from the environment",- "const refund_amount = pm.environment.get(\"amount\");",- "","// Validate status 2xx",- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "","// Set response object as internal variable","let jsonData = {};","try {"," jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",- "if (jsonData?.refund_id) {",- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);"," console.log(",- " \"- use {{refund_id}} as collection variable for value\",",- " jsonData.refund_id,",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\","," );","}","",- "// Response body should have value \"succeeded\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",- " },",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\","," );","}","",- "// Response body should have value \"{{refund_amount}}\" for \"amount\"",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"requires_payment_method\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/refunds - Content check if value for 'amount' matches '{{refund_amount}}'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\","," function () {",- " pm.expect(jsonData.amount).to.eql(refund_amount);",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");"," },"," );","}",@@ -3252,62 +3345,72 @@}],"request": {- "method": "GET",+ "method": "POST","header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },{"key": "Accept","value": "application/json"}],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },"url": {- "raw": "{{baseUrl}}/refunds/:id",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "refunds",- ":id"- ],- "variable": [- {- "key": "id",- "value": "{{refund_id}}",- "description": "(Required) unique refund id"- }+ "payments"]},- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []- }- ]- },- {- "name": "Scenario10-Partial refund",- "item": [+ },{- "name": "Payments - Create",+ "name": "Payments - Confirm","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",- "","// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- "});",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -3356,22 +3459,41 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"processing\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\","," function () {"," pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );",- "}",- ""+ "}"],"type": "text/javascript"}}],"request": {+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },"method": "POST","header": [{@@ -3385,23 +3507,32 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"\",\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"},"url": {- "raw": "{{baseUrl}}/payments",+ "raw": "{{baseUrl}}/payments/:id/confirm","host": ["{{baseUrl}}"],"path": [- "payments"+ "payments",+ ":id",+ "confirm"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }]},- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"},"response": []},@@ -3474,16 +3605,15 @@" );","}","",- "// Response body should have value \"Succeeded\" for \"status\"",+ "// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\","," function () {"," pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );",- "}",- ""+ "}"],"type": "text/javascript"}@@ -3523,61 +3653,97 @@"description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []- },+ }+ ]+ },+ {+ "name": "Scenario3-Create payment without PMD",+ "item": [{- "name": "Refunds - Create",+ "name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": ["// Validate status 2xx",- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "","// Set response object as internal variable","let jsonData = {};","try {"," jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",- "if (jsonData?.refund_id) {",- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);"," console.log(",- " \"- use {{refund_id}} as collection variable for value\",",- " jsonData.refund_id,",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\","," );","}","",- "// Response body should have value \"succeeded\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"pending\");",- " },",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\","," );","}","",- "// Response body should have value \"540\" for \"amount\"",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"requires_payment_method\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/refunds - Content check if value for 'amount' matches '100'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\","," function () {",- " pm.expect(jsonData.amount).to.eql(100);",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");"," },"," );","}",@@ -3606,38 +3772,55 @@"language": "json"}},- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":100,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {- "raw": "{{baseUrl}}/refunds",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "refunds"+ "payments"]},- "description": "To create a refund against an already processed payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []},{- "name": "Refunds - Retrieve",+ "name": "Payments - Confirm","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": ["// Validate status 2xx",- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();","});","","// Set response object as internal variable",@@ -3646,35 +3829,51 @@" jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",- "if (jsonData?.refund_id) {",- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);"," console.log(",- " \"- use {{refund_id}} as collection variable for value\",",- " jsonData.refund_id,",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\","," );","}","",- "// Response body should have value \"succeeded\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",- " },",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\","," );","}","",- "// Response body should have value \"6540\" for \"amount\"",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/refunds - Content check if value for 'amount' matches '100'\",",+ " \"[POST]::/payments:id/confirm - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.amount).to.eql(100);",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",@@ -3685,88 +3884,279 @@}],"request": {- "method": "GET",+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },+ "method": "POST","header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },{"key": "Accept","value": "application/json"}],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}}}"+ },"url": {- "raw": "{{baseUrl}}/refunds/:id",+ "raw": "{{baseUrl}}/payments/:id/confirm","host": ["{{baseUrl}}"],"path": [- "refunds",- ":id"+ "payments",+ ":id",+ "confirm"],"variable": [{"key": "id",- "value": "{{refund_id}}",- "description": "(Required) unique refund id"+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"}]},- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"},"response": []},{- "name": "Refunds - Create-copy",+ "name": "Payments - Retrieve","event": [{"listen": "test","script": {"exec": ["// Validate status 2xx",- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "","// Set response object as internal variable","let jsonData = {};","try {"," jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",- "if (jsonData?.refund_id) {",- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);"," console.log(",- " \"- use {{refund_id}} as collection variable for value\",",- " jsonData.refund_id,",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\","," );","}","","// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"pending\");",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario4-Create payment with Manual capture",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "pm.environment.set(\"amount\", pm.response.json().amount);","",- "// Response body should have value \"1000\" for \"amount\"",+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"requires_capture\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.amount).to.eql(10);",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",@@ -3795,75 +4185,6810 @@"language": "json"}},- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":10,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {- "raw": "{{baseUrl}}/refunds",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "refunds"+ "payments"]},- "description": "To create a refund against an already processed payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []},{- "name": "Refunds - Retrieve-copy",+ "name": "Payments - Retrieve","event": [{"listen": "test","script": {"exec": ["// Validate status 2xx",- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "","// Set response object as internal variable","let jsonData = {};","try {"," jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",- "if (jsonData?.refund_id) {",- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Payments - Capture",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(",+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"{{amount}}\" for \"amount\"",+ "if (jsonData?.amount) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"{{amount}}\" for \"amount_received\"",+ "if (jsonData?.amount_received) {",+ " pm.test(",+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/capture",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "capture"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To capture the funds for an uncaptured payment"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve-copy",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario5-Void the payment",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"requires_capture\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"cancelled\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Payments - Cancel",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments/:id/cancel - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(",+ " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"cancelled\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"cancellation_reason\":\"user_cancel\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/cancel",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "cancel"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve-copy",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"cancelled\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'cancelled'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"cancelled\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario6-Refund full payment",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "",+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"Succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx",+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"pending\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/refunds",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds"+ ]+ },+ "description": "To create a refund against an already processed payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Retrieve",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const refund_amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx",+ "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"{{refund_amount}}\" for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{refund_amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(refund_amount);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/refunds/:id",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds",+ ":id"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{refund_id}}",+ "description": "(Required) unique refund id"+ }+ ]+ },+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario7-Partial refund",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"Succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"pending\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"540\" for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '100'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(100);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":100,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/refunds",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds"+ ]+ },+ "description": "To create a refund against an already processed payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Retrieve",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"6540\" for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '100'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(100);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/refunds/:id",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds",+ ":id"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{refund_id}}",+ "description": "(Required) unique refund id"+ }+ ]+ },+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Create-copy",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"pending\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"1000\" for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(10);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":10,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/refunds",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds"+ ]+ },+ "description": "To create a refund against an already processed payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Retrieve-copy",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"6540\" for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(10);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/refunds/:id",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds",+ ":id"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{refund_id}}",+ "description": "(Required) unique refund id"+ }+ ]+ },+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve-copy",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"Succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have \"refunds\"",+ "pm.test(\"[POST]::/payments - Content check if 'refunds' exists\", function () {",+ " pm.expect(typeof jsonData.refunds !== \"undefined\").to.be.true;",+ "});",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario8-Create a failure card payment with confirm true",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'failed'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"failed\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have \"connector_transaction_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",+ " .true;",+ " },",+ ");",+ "",+ "// Response body should have value \"200\" for \"error_code\"",+ "if (jsonData?.error_code) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches '200'\",",+ " function () {",+ " pm.expect(jsonData.error_code).to.eql(\"200\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"message - DECLINE\"",+ "if (jsonData?.error_message) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'DECLINE'\",",+ " function () {",+ " pm.expect(jsonData.error_message).to.eql(\"DECLINE\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"Succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'failed'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"failed\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have \"connector_transaction_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",+ " .true;",+ " },",+ ");",+ "",+ "// Response body should have value \"200\" for \"error_code\"",+ "if (jsonData?.error_code) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches '200'\",",+ " function () {",+ " pm.expect(jsonData.error_code).to.eql(\"200\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"message - DECLINE\"",+ "if (jsonData?.error_message) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'DECLINE'\",",+ " function () {",+ " pm.expect(jsonData.error_message).to.eql(\"DECLINE\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario9-Update amount with automatic capture",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};",+ "// Response body should have value \"requires_payment_method\" for \"status\"",+ "if (jsonData?.status) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",+ "})};",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Update",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "pm.environment.set(\"another_random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "",+ "// Get the value of 'amount' from the environment",+ "const updated_amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "",+ "// Parse the JSON response",+ "var jsonData = pm.response.json();",+ "",+ "// Check if the 'amount' is equal to \"updated_amount\"",+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{updated_amount}}'\", function () {",+ " pm.expect(jsonData.amount).to.eql(updated_amount);",+ "});",+ "",+ "",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{another_random_number}}\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}"+ }+ ]+ },+ "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created "+ },+ "response": []+ },+ {+ "name": "Payments - Confirm",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments/:id/confirm - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "//// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'processing'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ "})};",+ "",+ "",+ "// Check if the 'amount' is equal to \"amount\"",+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ "});",+ "",+ "//// Response body should have value \"amount_received\" for \"amount\"",+ "if (jsonData?.amount_received) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ "})};",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ },+ {+ "key": "x-feature",+ "value": "router-custom",+ "type": "text",+ "disabled": true+ },+ {+ "key": "publishable_key",+ "value": "",+ "type": "text",+ "disabled": true+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"setup_future_usage\":\"on_session\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"128.0.0.1\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/confirm",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "confirm"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}"+ }+ ]+ },+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "//// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ "})};",+ "",+ "",+ "// Check if the 'amount' is equal to \"amount\"",+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ "});",+ "",+ "//// Response body should have value \"amount_received\" for \"amount\"",+ "if (jsonData?.amount_received) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ "})};",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario9a-Update amount with manual capture",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};",+ "// Response body should have value \"requires_payment_method\" for \"status\"",+ "if (jsonData?.status) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",+ "})};",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Update",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "pm.environment.set(\"another_random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "",+ "// Get the value of 'amount' from the environment",+ "const updated_amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "",+ "// Parse the JSON response",+ "var jsonData = pm.response.json();",+ "",+ "// Check if the 'amount' is equal to \"updated_amount\"",+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{updated_amount}}'\", function () {",+ " pm.expect(jsonData.amount).to.eql(updated_amount);",+ "});",+ "",+ "",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{another_random_number}}\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}"+ }+ ]+ },+ "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created "+ },+ "response": []+ },+ {+ "name": "Payments - Confirm",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments/:id/confirm - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "//// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'processing'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ "})};",+ "",+ "",+ "// Check if the 'amount' is equal to \"amount\"",+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ "});",+ "",+ "//// Response body should have value \"amount_received\" for \"amount\"",+ "if (jsonData?.amount_received) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ "})};",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ },+ {+ "key": "x-feature",+ "value": "router-custom",+ "type": "text",+ "disabled": true+ },+ {+ "key": "publishable_key",+ "value": "",+ "type": "text",+ "disabled": true+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"setup_future_usage\":\"on_session\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"128.0.0.1\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/confirm",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "confirm"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}"+ }+ ]+ },+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "//// Response body should have value \"requires_capture\" for \"status\"",+ "if (jsonData?.status) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ "})};",+ "",+ "",+ "// Check if the 'amount' is equal to \"amount\"",+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ "});",+ "",+ "//// Response body should have value \"amount_received\" for \"amount\"",+ "if (jsonData?.amount_received) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ "})};",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Payments - Capture",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(",+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ "",+ "// Validate the connector",+ "pm.test(\"[POST]::/payments - connector\", function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ "});",+ "",+ "// Response body should have value \"amount\" for \"amount_received\"",+ "if (jsonData?.amount_received) {",+ " pm.test(",+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"0\" for \"amount_capturable\"",+ "if (jsonData?.amount_capturable) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'\",",+ " function () {",+ " pm.expect(jsonData.amount_capturable).to.eql(amount);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/capture",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "capture"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To capture the funds for an uncaptured payment"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve Copy",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "//// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ "})};",+ "",+ "",+ "// Check if the 'amount' is equal to \"amount\"",+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ "});",+ "",+ "//// Response body should have value \"amount_received\" for \"amount\"",+ "if (jsonData?.amount_received) {",+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ "})};",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario12-Add card flow",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " })};"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "List payment methods for a Customer",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "if (jsonData?.customer_payment_methods[0]?.payment_token) {",+ " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",+ " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",+ "}"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "customers",+ ":customer_id",+ "payment_methods"+ ],+ "query": [+ {+ "key": "accepted_country",+ "value": "co",+ "disabled": true+ },+ {+ "key": "accepted_country",+ "value": "pa",+ "disabled": true+ },+ {+ "key": "accepted_currency",+ "value": "voluptate ea",+ "disabled": true+ },+ {+ "key": "accepted_currency",+ "value": "exercitation",+ "disabled": true+ },+ {+ "key": "minimum_amount",+ "value": "100",+ "disabled": true+ },+ {+ "key": "maximum_amount",+ "value": "10000000",+ "disabled": true+ },+ {+ "key": "recurring_payment_enabled",+ "value": "true",+ "disabled": true+ },+ {+ "key": "installment_payment_enabled",+ "value": "true",+ "disabled": true+ }+ ],+ "variable": [+ {+ "key": "customer_id",+ "value": "{{customer_id}}",+ "description": "//Pass the customer id"+ }+ ]+ },+ "description": "To filter and list the applicable payment methods for a particular Customer ID"+ },+ "response": []+ },+ {+ "name": "Save card payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Save card payments - Confirm",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ "",+ "",+ "// Response body should have value \"nmi\" for \"connector\"",+ "if (jsonData?.connector) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'nmi'\",",+ " function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"737\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/confirm",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "confirm"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario13-Don't Pass CVV for save card flow and verify success payment",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ "",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"stripesavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "List payment methods for a Customer",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "if (jsonData?.customer_payment_methods[0]?.payment_token) {",+ " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",+ " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",+ "}"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "customers",+ ":customer_id",+ "payment_methods"+ ],+ "query": [+ {+ "key": "accepted_country",+ "value": "co",+ "disabled": true+ },+ {+ "key": "accepted_country",+ "value": "pa",+ "disabled": true+ },+ {+ "key": "accepted_currency",+ "value": "voluptate ea",+ "disabled": true+ },+ {+ "key": "accepted_currency",+ "value": "exercitation",+ "disabled": true+ },+ {+ "key": "minimum_amount",+ "value": "100",+ "disabled": true+ },+ {+ "key": "maximum_amount",+ "value": "10000000",+ "disabled": true+ },+ {+ "key": "recurring_payment_enabled",+ "value": "true",+ "disabled": true+ },+ {+ "key": "installment_payment_enabled",+ "value": "true",+ "disabled": true+ }+ ],+ "variable": [+ {+ "key": "customer_id",+ "value": "{{customer_id}}",+ "description": "//Pass the customer id"+ }+ ]+ },+ "description": "To filter and list the applicable payment methods for a particular Customer ID"+ },+ "response": []+ },+ {+ "name": "Save card payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "// Response body should have value \"requires_payment_method\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",+ " },",+ " );",+ "}",+ "",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Save card payments - Confirm",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"nmi\" for \"connector\"",+ "if (jsonData?.connector) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'nmi'\",",+ " function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\", function() {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " })};"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/confirm",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "confirm"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario14-Save card payment with manual capture",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"nmisavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"Succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Validate the connector",+ "pm.test(\"[POST]::/payments - connector\", function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ "});",+ "",+ "// Response body should have value \"0\" for \"amount_capturable\"",+ "if (jsonData?.amount) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'\",",+ " function () {",+ " pm.expect(jsonData.amount_capturable).to.eql(0);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "List payment methods for a Customer",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx ",+ "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "if (jsonData?.customer_payment_methods[0]?.payment_token) {",+ " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",+ " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",+ "}"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "customers",+ ":customer_id",+ "payment_methods"+ ],+ "query": [+ {+ "key": "accepted_country",+ "value": "co",+ "disabled": true+ },+ {+ "key": "accepted_country",+ "value": "pa",+ "disabled": true+ },+ {+ "key": "accepted_currency",+ "value": "voluptate ea",+ "disabled": true+ },+ {+ "key": "accepted_currency",+ "value": "exercitation",+ "disabled": true+ },+ {+ "key": "minimum_amount",+ "value": "100",+ "disabled": true+ },+ {+ "key": "maximum_amount",+ "value": "10000000",+ "disabled": true+ },+ {+ "key": "recurring_payment_enabled",+ "value": "true",+ "disabled": true+ },+ {+ "key": "installment_payment_enabled",+ "value": "true",+ "disabled": true+ }+ ],+ "variable": [+ {+ "key": "customer_id",+ "value": "{{customer_id}}",+ "description": "//Pass the customer id"+ }+ ]+ },+ "description": "To filter and list the applicable payment methods for a particular Customer ID"+ },+ "response": []+ },+ {+ "name": "Save card payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);",+ "",+ "// Validate status 2xx ",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",+ "});",+ "",+ "// Validate if response has JSON Body ",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {jsonData = pm.response.json();}catch(e){}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",+ "};",+ "",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",+ "};",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",+ "};",+ "",+ "// Response body should have value \"requires_payment_method\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",+ " },",+ " );",+ "}",+ "",+ "if (jsonData?.customer_id) {",+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",+ "} else {",+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",+ "};"+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Save card payments - Confirm",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ "",+ "",+ "// Response body should have value \"nmi\" for \"connector\"",+ "if (jsonData?.connector) {",+ " pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'nmi'\",",+ " function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"7373\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/confirm",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "confirm"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve-copy",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"requires_capture\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ " },",+ " );",+ "}",+ "",+ "// Validate the connector",+ "pm.test(\"[POST]::/payments - connector\", function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ "});",+ "",+ "// Response body should have value \"amount\" for \"amount\"",+ "if (jsonData?.amount) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"amount\" for \"amount_received\"",+ "if (jsonData?.amount_received) {",+ " pm.test(",+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"amount\" for \"amount_capturable\"",+ "if (jsonData?.amount) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - {{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount_capturable).to.eql(amount);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Payments - Capture",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(",+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ "",+ "// Validate the connector",+ "pm.test(\"[POST]::/payments - connector\", function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ "});",+ "",+ "// Response body should have value \"amount\" for \"amount_received\"",+ "if (jsonData?.amount_received) {",+ " pm.test(",+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"0\" for \"amount_capturable\"",+ "if (jsonData?.amount_capturable) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'\",",+ " function () {",+ " pm.expect(jsonData.amount_capturable).to.eql(amount);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments/:id/capture",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id",+ "capture"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To capture the funds for an uncaptured payment"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve-copy-2",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = pm.environment.get(\"amount\");",+ "",+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"Succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Validate the connector",+ "pm.test(\"[POST]::/payments - connector\", function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ "});",+ "",+ "// Response body should have value \"amount\" for \"amount\"",+ "if (jsonData?.amount) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(amount);",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"amount\" for \"amount_received\"",+ "if (jsonData?.amount_received) {",+ " pm.test(",+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",+ " function () {",+ " pm.expect(jsonData.amount_received).to.eql(amount);",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"6540\" for \"amount_capturable\"",+ "if (jsonData?.amount) {",+ " pm.test(",+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",+ " function () {",+ " pm.expect(jsonData.amount_capturable).to.eql(0);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Create Copy",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"pending\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"pending\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"10\" for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(10);",+ " },",+ " );",+ "}",+ "",+ "// Validate the connector",+ "pm.test(\"[POST]::/payments - connector\", function () {",+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",+ "});",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":10,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/refunds",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds"+ ]+ },+ "description": "To create a refund against an already processed payment"+ },+ "response": []+ },+ {+ "name": "Refunds - Retrieve Copy",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",+ " console.log(",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have value \"10\" for \"amount\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",+ " function () {",+ " pm.expect(jsonData.amount).to.eql(10);",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/refunds/:id",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "refunds",+ ":id"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{refund_id}}",+ "description": "(Required) unique refund id"+ }+ ]+ },+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ },+ {+ "name": "Scenario15-Create payment without customer_id and with billing address and shipping address",+ "item": [+ {+ "name": "Payments - Create",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"processing\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"processing\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have \"connector_transaction_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",+ " .true;",+ " },",+ ");",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"01\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Retrieve",+ "event": [+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have value \"Succeeded\" for \"status\"",+ "if (jsonData?.status) {",+ " pm.test(",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " function () {",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " },",+ " );",+ "}",+ "",+ "// Response body should have \"connector_transaction_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",+ " .true;",+ " },",+ ");",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "GET",+ "header": [+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "url": {+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }+ ]+ },+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ },+ "response": []+ }+ ]+ }+ ]+ },+ {+ "name": "Variation Cases",+ "item": [+ {+ "name": "Scenario1-Create payment with Invalid card details",+ "item": [+ {+ "name": "Payments - Create(Invalid card number)",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 4xx",+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",+ " pm.response.to.be.error;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have \"error\"",+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",+ "});",+ "",+ "// Response body should have value \"connector error\" for \"error type\"",+ "if (jsonData?.error?.type) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector_error'\",",+ " function () {",+ " pm.expect(jsonData.error.type).to.eql(\"connector_error\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"123456\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Create(Invalid Exp month)",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 4xx",+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",+ " pm.response.to.be.error;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ " console.log(",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " );",+ "}",+ "",+ "// Response body should have \"next_action.redirect_to_url\"",+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",+ "});",+ "",+ "// Response body should have value \"connector error\" for \"error type\"",+ "if (jsonData?.error?.type) {",+ " pm.test(",+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",",+ " function () {",+ " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",+ " },",+ " );",+ "}",+ ""+ ],+ "type": "text/javascript"+ }+ }+ ],+ "request": {+ "method": "POST",+ "header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },+ {+ "key": "Accept",+ "value": "application/json"+ }+ ],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":2222,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":2222,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"01\",\"card_exp_year\":\"2023\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },+ "url": {+ "raw": "{{baseUrl}}/payments",+ "host": [+ "{{baseUrl}}"+ ],+ "path": [+ "payments"+ ]+ },+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ },+ "response": []+ },+ {+ "name": "Payments - Create(Invalid Exp Year)",+ "event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 4xx",+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",+ " pm.response.to.be.error;",+ "});",+ "",+ "// Validate if response header has matching content-type",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});",+ "",+ "// Validate if response has JSON Body",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ " pm.response.to.have.jsonBody();",+ "});",+ "",+ "// Set response object as internal variable",+ "let jsonData = {};",+ "try {",+ " jsonData = pm.response.json();",+ "} catch (e) {}",+ "",+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",+ "if (jsonData?.payment_id) {",+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",+ " console.log(",+ " \"- use {{payment_id}} as collection variable for value\",",+ " jsonData.payment_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",+ "if (jsonData?.mandate_id) {",+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",+ " console.log(",+ " \"- use {{mandate_id}} as collection variable for value\",",+ " jsonData.mandate_id,",+ " );",+ "} else {",+ " console.log(",+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",+ " );",+ "}",+ "",+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",+ "if (jsonData?.client_secret) {",+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);"," console.log(",- " \"- use {{refund_id}} as collection variable for value\",",- " jsonData.refund_id,",+ " \"- use {{client_secret}} as collection variable for value\",",+ " jsonData.client_secret,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\","," );","}","",- "// Response body should have value \"succeeded\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",- " },",- " );",- "}",+ "// Response body should have \"next_action.redirect_to_url\"",+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",+ "});","",- "// Response body should have value \"6540\" for \"amount\"",- "if (jsonData?.status) {",+ "// Response body should have value \"connector error\" for \"error type\"",+ "if (jsonData?.error?.type) {"," pm.test(",- " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\","," function () {",- " pm.expect(jsonData.amount).to.eql(10);",+ " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");"," },"," );","}",@@ -3874,55 +10999,69 @@}],"request": {- "method": "GET",+ "method": "POST","header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },{"key": "Accept","value": "application/json"}],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2022\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ },"url": {- "raw": "{{baseUrl}}/refunds/:id",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "refunds",- ":id"- ],- "variable": [- {- "key": "id",- "value": "{{refund_id}}",- "description": "(Required) unique refund id"- }+ "payments"]},- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []},{- "name": "Payments - Retrieve-copy",+ "name": "Payments - Create(invalid CVV)","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "// Validate status 2xx",- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",- " pm.response.to.be.success;",+ "// Validate status 4xx",+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",+ " pm.response.to.be.error;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","","// Validate if response has JSON Body",- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -3971,20 +11110,20 @@" );","}","",- "// Response body should have value \"Succeeded\" for \"status\"",- "if (jsonData?.status) {",+ "// Response body should have \"error\"",+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",+ "});",+ "",+ "// Response body should have value \"connector error\" for \"error type\"",+ "if (jsonData?.error?.type) {"," pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " pm.expect(jsonData.error.type).to.eql(\"connector\");"," },"," );","}",- "",- "// Response body should have \"refunds\"",- "pm.test(\"[POST]::/payments - Content check if 'refunds' exists\", function () {",- " pm.expect(typeof jsonData.refunds !== \"undefined\").to.be.true;",- "});",""],"type": "text/javascript"@@ -3992,62 +11131,64 @@}],"request": {- "method": "GET",+ "method": "POST","header": [+ {+ "key": "Content-Type",+ "value": "application/json"+ },{"key": "Accept","value": "application/json"}],+ "body": {+ "mode": "raw",+ "options": {+ "raw": {+ "language": "json"+ }+ },+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"123456\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"12345\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"+ },"url": {- "raw": "{{baseUrl}}/payments/:id?force_sync=true",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "payments",- ":id"- ],- "query": [- {- "key": "force_sync",- "value": "true"- }- ],- "variable": [- {- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"- }+ "payments"]},- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []}]- }- ]- },- {- "name": "Variation Cases",- "item": [+ },{- "name": "Scenario1-Create payment with Invalid card details",+ "name": "Scenario2-Confirming the payment without PMD","item": [{- "name": "Payments - Create(Invalid card number)",+ "name": "Payments - Create","event": [{- "listen": "test",+ "listen": "prerequest","script": {"exec": ["pm.environment.set(\"random_number\", _.random(100, 100000));",- "",- "// Validate status 4xx",- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",- " pm.response.to.be.error;",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": [+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;","});","","// Validate if response header has matching content-type",@@ -4107,17 +11248,12 @@" );","}","",- "// Response body should have \"error\"",- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",- "});",- "",- "// Response body should have value \"connector error\" for \"error type\"",- "if (jsonData?.error?.type) {",+ "// Response body should have value \"requires_payment_method\" for \"status\"",+ "if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector_error'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\","," function () {",- " pm.expect(jsonData.error.type).to.eql(\"connector_error\");",+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");"," },"," );","}",@@ -4141,12 +11277,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"123456\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -4162,8 +11298,17 @@"response": []},{- "name": "Payments - Create(Invalid Exp month)",+ "name": "Payments - Confirm","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {@@ -4174,14 +11319,17 @@"});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- "});",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -4230,15 +11378,18 @@" );","}","",- "// Response body should have \"next_action.redirect_to_url\"",- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",- "});",+ "// Response body should have \"error\"",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",+ " },",+ ");","","// Response body should have value \"connector error\" for \"error type\"","if (jsonData?.error?.type) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\","," function () {"," pm.expect(jsonData.error.type).to.eql(\"invalid_request\");"," },",@@ -4251,6 +11402,26 @@}],"request": {+ "auth": {+ "type": "apikey",+ "apikey": [+ {+ "key": "value",+ "value": "{{publishable_key}}",+ "type": "string"+ },+ {+ "key": "key",+ "value": "api-key",+ "type": "string"+ },+ {+ "key": "in",+ "value": "header",+ "type": "string"+ }+ ]+ },"method": "POST","header": [{@@ -4269,31 +11440,55 @@"language": "json"}},- "raw": "{\"amount\":2222,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":2222,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"01\",\"card_exp_year\":\"2023\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ "raw": "{\"client_secret\":\"{{client_secret}}\"}"},"url": {- "raw": "{{baseUrl}}/payments",+ "raw": "{{baseUrl}}/payments/:id/confirm","host": ["{{baseUrl}}"],"path": [- "payments"+ "payments",+ ":id",+ "confirm"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }]},- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"},"response": []- },+ }+ ]+ },+ {+ "name": "Scenario3-Capture greater amount",+ "item": [{- "name": "Payments - Create(Invalid Exp Year)",+ "name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "// Validate status 4xx",- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",- " pm.response.to.be.error;",+ "// Validate status 2xx",+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",+ " pm.response.to.be.success;","});","","// Validate if response header has matching content-type",@@ -4353,17 +11548,12 @@" );","}","",- "// Response body should have \"next_action.redirect_to_url\"",- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",- "});",- "",- "// Response body should have value \"connector error\" for \"error type\"",- "if (jsonData?.error?.type) {",+ "// Response body should have value \"requires_capture\" for \"status\"",+ "if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",@@ -4387,12 +11577,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4242424242424242\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"2022\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -4408,28 +11598,26 @@"response": []},{- "name": "Payments - Create(invalid CVV)",+ "name": "Payments - Retrieve","event": [{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",- "",- "// Validate status 4xx",- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",- " pm.response.to.be.error;",+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -4478,17 +11666,12 @@" );","}","",- "// Response body should have \"error\"",- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",- "});",- "",- "// Response body should have value \"connector error\" for \"error type\"",- "if (jsonData?.error?.type) {",+ "// Response body should have value \"requires_capture\" for \"status\"",+ "if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\","," function () {",- " pm.expect(jsonData.error.type).to.eql(\"connector\");",+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");"," },"," );","}",@@ -4499,67 +11682,76 @@}],"request": {- "method": "POST",+ "method": "GET","header": [- {- "key": "Content-Type",- "value": "application/json"- },{"key": "Accept","value": "application/json"}],- "body": {- "mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"123456\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"12345\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",- "options": {- "raw": {- "language": "json"- }- }- },"url": {- "raw": "{{baseUrl}}/payments",+ "raw": "{{baseUrl}}/payments/:id?force_sync=true","host": ["{{baseUrl}}"],"path": [- "payments"+ "payments",+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }]},- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []- }- ]- },- {- "name": "Scenario2-Confirming the payment without PMD",- "item": [+ },{- "name": "Payments - Create",+ "name": "Payments - Capture","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",+ "// Get the value of 'amount' from the environment",+ "const capture_amount = parseInt(pm.environment.get(\"amount\")) + 1000;","",- "// Validate status 2xx",- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",- " pm.response.to.be.success;",+ "// Validate status 4xx",+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {",+ " pm.response.to.be.error;","});","","// Validate if response header has matching content-type",- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- "});",+ "pm.test(",+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",+ " function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ " },",+ ");","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -4608,12 +11800,20 @@" );","}","",- "// Response body should have value \"requires_payment_method\" for \"status\"",- "if (jsonData?.status) {",+ "// Response body should have \"error\"",+ "pm.test(",+ " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have value \"connector error\" for \"error type\"",+ "if (jsonData?.error?.type) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",+ " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");"," },"," );","}",@@ -4637,50 +11837,56 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount_to_capture\":\"{{capture_amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"},"url": {- "raw": "{{baseUrl}}/payments",+ "raw": "{{baseUrl}}/payments/:id/capture","host": ["{{baseUrl}}"],"path": [- "payments"+ "payments",+ ":id",+ "capture"+ ],+ "variable": [+ {+ "key": "id",+ "value": "{{payment_id}}",+ "description": "(Required) unique payment id"+ }]},- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"+ "description": "To capture the funds for an uncaptured payment"},"response": []},{- "name": "Payments - Confirm",+ "name": "Payments - Retrieve-copy","event": [{"listen": "test","script": {"exec": [- "// Validate status 4xx",- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",- " pm.response.to.be.error;",+ "// Validate status 2xx",+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",+ " pm.response.to.be.success;","});","","// Validate if response header has matching content-type",- "pm.test(",- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",- " function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- " },",- ");",+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );",+ "});","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -4729,20 +11935,12 @@" );","}","",- "// Response body should have \"error\"",- "pm.test(",- " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",- " function () {",- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",- " },",- ");",- "",- "// Response body should have value \"connector error\" for \"error type\"",- "if (jsonData?.error?.type) {",+ "// Response body should have value \"requires_capture\" for \"status\"",+ "if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\","," function () {",- " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");"," },"," );","}",@@ -4753,55 +11951,27 @@}],"request": {- "auth": {- "type": "apikey",- "apikey": [- {- "key": "value",- "value": "{{publishable_key}}",- "type": "string"- },- {- "key": "key",- "value": "api-key",- "type": "string"- },- {- "key": "in",- "value": "header",- "type": "string"- }- ]- },- "method": "POST",+ "method": "GET","header": [- {- "key": "Content-Type",- "value": "application/json"- },{"key": "Accept","value": "application/json"}],- "body": {- "mode": "raw",- "options": {- "raw": {- "language": "json"- }- },- "raw": "{\"client_secret\":\"{{client_secret}}\"}"- },"url": {- "raw": "{{baseUrl}}/payments/:id/confirm",+ "raw": "{{baseUrl}}/payments/:id?force_sync=true","host": ["{{baseUrl}}"],"path": ["payments",- ":id",- "confirm"+ ":id"+ ],+ "query": [+ {+ "key": "force_sync",+ "value": "true"+ }],"variable": [{@@ -4811,24 +11981,32 @@}]},- "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"},"response": []}]},{- "name": "Scenario3-Capture greater amount",+ "name": "Scenario4-Capture the succeeded payment","item": [{"name": "Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ "pm.environment.set(\"random_number\", _.random(100, 100000));",+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",- "","// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -4891,7 +12069,7 @@" );","}","",- "// Response body should have value \"requires_capture\" for \"status\"",+ "// Response body should have value \"succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test("," \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",@@ -4920,12 +12098,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"manual\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -5009,12 +12187,12 @@" );","}","",- "// Response body should have value \"requires_capture\" for \"status\"",+ "// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",@@ -5062,13 +12240,19 @@{"name": "Payments - Capture","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "// Get the value of 'amount' from the environment",- "const capture_amount = parseInt(pm.environment.get(\"amount\")) + 1000;",- "","// Validate status 4xx","pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {"," pm.response.to.be.error;",@@ -5171,12 +12355,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount_to_capture\": {{capture_amount}},\n \"statement_descriptor_name\": \"Joseph\",\n \"statement_descriptor_suffix\": \"JS\"\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount_to_capture\":7000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"},"url": {"raw": "{{baseUrl}}/payments/:id/capture",@@ -5269,12 +12453,12 @@" );","}","",- "// Response body should have value \"requires_capture\" for \"status\"",+ "// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",@@ -5322,17 +12506,25 @@]},{- "name": "Scenario4-Capture the succeeded payment",+ "name": "Scenario5-Void the success_slash_failure payment","item": [{"name": "Payments - Create","event": [{- "listen": "test",+ "listen": "prerequest","script": {"exec": ["pm.environment.set(\"random_number\", _.random(100, 100000));",- "",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": ["// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -5424,12 +12616,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -5564,20 +12756,29 @@"response": []},{- "name": "Payments - Capture",+ "name": "Payments - Cancel","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": ["// Validate status 4xx",- "pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {",+ "pm.test(\"[POST]::/payments/:id/cancel - Status code is 4xx\", function () {"," pm.response.to.be.error;","});","","// Validate if response header has matching content-type","pm.test(",- " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",+ " \"[POST]::/payments/:id/cancel - Content-Type is application/json\","," function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\",",@@ -5586,7 +12787,7 @@");","","// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -5609,19 +12810,6 @@" );","}","",- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",- "if (jsonData?.mandate_id) {",- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",- " console.log(",- " \"- use {{mandate_id}} as collection variable for value\",",- " jsonData.mandate_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",- " );",- "}",- "","// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret","if (jsonData?.client_secret) {"," pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",@@ -5677,17 +12865,17 @@"language": "json"}},- "raw": "{\"amount_to_capture\":7000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"+ "raw": "{\"cancellation_reason\":\"user_cancel\"}"},"url": {- "raw": "{{baseUrl}}/payments/:id/capture",+ "raw": "{{baseUrl}}/payments/:id/cancel","host": ["{{baseUrl}}"],"path": ["payments",":id",- "capture"+ "cancel"],"variable": [{@@ -5697,142 +12885,34 @@}]},- "description": "To capture the funds for an uncaptured payment"+ "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"},"response": []- },+ }+ ]+ },+ {+ "name": "Scenario7-Refund exceeds amount",+ "item": [{- "name": "Payments - Retrieve-copy",+ "name": "Payments - Create","event": [{- "listen": "test",+ "listen": "prerequest","script": {"exec": [- "// Validate status 2xx",- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",- " pm.response.to.be.success;",- "});",- "",- "// Validate if response header has matching content-type",- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- "});",- "",- "// Validate if response has JSON Body",- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",- " pm.response.to.have.jsonBody();",- "});",- "",- "// Set response object as internal variable",- "let jsonData = {};",- "try {",- " jsonData = pm.response.json();",- "} catch (e) {}",- "",- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",- "if (jsonData?.payment_id) {",- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",- " console.log(",- " \"- use {{payment_id}} as collection variable for value\",",- " jsonData.payment_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",- " );",- "}",- "",- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",- "if (jsonData?.mandate_id) {",- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",- " console.log(",- " \"- use {{mandate_id}} as collection variable for value\",",- " jsonData.mandate_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",- " );",- "}",- "",- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",- "if (jsonData?.client_secret) {",- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",- " console.log(",- " \"- use {{client_secret}} as collection variable for value\",",- " jsonData.client_secret,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",- " );",- "}",- "",- "// Response body should have value \"Succeeded\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",- " },",- " );",- "}",+ "pm.environment.set(\"random_number\", _.random(100, 100000));",""],"type": "text/javascript"}- }- ],- "request": {- "method": "GET",- "header": [- {- "key": "Accept",- "value": "application/json"- }- ],- "url": {- "raw": "{{baseUrl}}/payments/:id?force_sync=true",- "host": [- "{{baseUrl}}"- ],- "path": [- "payments",- ":id"- ],- "query": [- {- "key": "force_sync",- "value": "true"- }- ],- "variable": [- {- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"- }- ]},- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"- },- "response": []- }- ]- },- {- "name": "Scenario5-Void the success_slash_failure payment",- "item": [- {- "name": "Payments - Create",- "event": [{"listen": "test","script": {"exec": [- "pm.environment.set(\"random_number\", _.random(100, 100000));",+ "// Set the environment variable 'amount' with the value from the response",+ "pm.environment.set(\"amount\", pm.response.json().amount);","","// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",@@ -5925,12 +13005,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -5952,6 +13032,9 @@"listen": "test","script": {"exec": [+ "// Get the value of 'amount' from the environment",+ "const amount = parseInt(pm.environment.get(\"amount\")) + 100000;",+ "","// Validate status 2xx","pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -6065,30 +13148,37 @@"response": []},{- "name": "Payments - Cancel",+ "name": "Refunds - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [+ "// Get the value of 'amount' from the environment",+ "const refund_amount = parseInt(pm.environment.get(\"amount\") + 100000);",+ "",+ "// Set 'refund_amount' as an environment variable for the current request",+ "pm.environment.set(\"refund_amount\", refund_amount);",+ "","// Validate status 4xx",- "pm.test(\"[POST]::/payments/:id/cancel - Status code is 4xx\", function () {",+ "pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {"," pm.response.to.be.error;","});","","// Validate if response header has matching content-type",- "pm.test(",- " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",- " function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- " },",- ");",- "",- "// Validate if response has JSON Body",- "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",- " pm.response.to.have.jsonBody();",+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",+ " \"application/json\",",+ " );","});","","// Set response object as internal variable",@@ -6097,29 +13187,16 @@" jsonData = pm.response.json();","} catch (e) {}","",- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",- "if (jsonData?.payment_id) {",- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",- " console.log(",- " \"- use {{payment_id}} as collection variable for value\",",- " jsonData.payment_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",- " );",- "}",- "",- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",- "if (jsonData?.client_secret) {",- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",+ "if (jsonData?.refund_id) {",+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);"," console.log(",- " \"- use {{client_secret}} as collection variable for value\",",- " jsonData.client_secret,",+ " \"- use {{refund_id}} as collection variable for value\",",+ " jsonData.refund_id,"," );","} else {"," console.log(",- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\","," );","}","",@@ -6165,47 +13242,43 @@"language": "json"}},- "raw": "{\"cancellation_reason\":\"user_cancel\"}"+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{refund_amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {- "raw": "{{baseUrl}}/payments/:id/cancel",+ "raw": "{{baseUrl}}/refunds","host": ["{{baseUrl}}"],"path": [- "payments",- ":id",- "cancel"- ],- "variable": [- {- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"- }+ "refunds"]},- "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"+ "description": "To create a refund against an already processed payment"},"response": []}]},{- "name": "Scenario7-Refund exceeds amount",+ "name": "Scenario8-Refund for unsuccessful payment","item": [{"name": "Payments - Create","event": [{- "listen": "test",+ "listen": "prerequest","script": {"exec": ["pm.environment.set(\"random_number\", _.random(100, 100000));",- "",- "// Set the environment variable 'amount' with the value from the response",- "pm.environment.set(\"amount\", pm.response.json().amount);",- "",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": ["// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -6268,12 +13341,12 @@" );","}","",- "// Response body should have value \"succeeded\" for \"status\"",+ "// Response body should have value \"requires_confirmation\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"processing\");",+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");"," },"," );","}",@@ -6297,12 +13370,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -6324,9 +13397,6 @@"listen": "test","script": {"exec": [- "// Get the value of 'amount' from the environment",- "const amount = parseInt(pm.environment.get(\"amount\")) + 100000;",- "","// Validate status 2xx","pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -6392,9 +13462,9 @@"// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"succeeded\");",+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");"," },"," );","}",@@ -6442,16 +13512,19 @@{"name": "Refunds - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "// Get the value of 'amount' from the environment",- "const refund_amount = parseInt(pm.environment.get(\"amount\") + 100000);",- "",- "// Set 'refund_amount' as an environment variable for the current request",- "pm.environment.set(\"refund_amount\", refund_amount);",- "","// Validate status 4xx","pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {"," pm.response.to.be.error;",@@ -6491,7 +13564,7 @@" },",");","",- "// Response body should have value \"connector error\" for \"error type\"",+ "// Response body should have value \"invalid_request\" for \"error type\"","if (jsonData?.error?.type) {"," pm.test("," \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",",@@ -6520,12 +13593,12 @@],"body": {"mode": "raw",- "raw": "{\n \"payment_id\": \"{{payment_id}}\",\n \"amount\": {{refund_amount}},\n \"reason\": \"Customer returned product\",\n \"refund_type\": \"instant\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"},"url": {"raw": "{{baseUrl}}/refunds",@@ -6543,17 +13616,25 @@]},{- "name": "Scenario8-Refund for unsuccessful payment",+ "name": "Scenario9-Create a recurring payment with greater mandate amount Copy","item": [{"name": "Payments - Create","event": [{- "listen": "test",+ "listen": "prerequest","script": {"exec": ["pm.environment.set(\"random_number\", _.random(100, 100000));",- "",+ ""+ ],+ "type": "text/javascript"+ }+ },+ {+ "listen": "test",+ "script": {+ "exec": ["// Validate status 2xx","pm.test(\"[POST]::/payments - Status code is 2xx\", function () {"," pm.response.to.be.success;",@@ -6616,15 +13697,31 @@" );","}","",- "// Response body should have value \"requires_confirmation\" for \"status\"",+ "// Response body should have value \"processing\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",+ " pm.expect(jsonData.status).to.eql(\"processing\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -6645,12 +13742,12 @@],"body": {"mode": "raw",- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}","options": {"raw": {"language": "json"}- }+ },+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"},"url": {"raw": "{{baseUrl}}/payments",@@ -6737,12 +13834,28 @@"// Response body should have value \"Succeeded\" for \"status\"","if (jsonData?.status) {"," pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\","," function () {",- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",+ " pm.expect(jsonData.status).to.eql(\"succeeded\");"," },"," );","}",+ "",+ "// Response body should have \"mandate_id\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",+ " },",+ ");",+ "",+ "// Response body should have \"mandate_data\"",+ "pm.test(",+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",+ " function () {",+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",+ " },",+ ");",""],"type": "text/javascript"@@ -6785,26 +13898,35 @@"response": []},{- "name": "Payments - Retrieve-copy",+ "name": "Recurring Payments - Create","event": [+ {+ "listen": "prerequest",+ "script": {+ "exec": [+ ""+ ],+ "type": "text/javascript"+ }+ },{"listen": "test","script": {"exec": [- "// Validate status 2xx",- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",- " pm.response.to.be.success;",+ "// Validate status 4xx",+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",+ " pm.response.to.be.error;","});","","// Validate if response header has matching content-type",- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {"," pm.expect(pm.response.headers.get(\"Content-Type\")).to.include("," \"application/json\","," );","});","","// Validate if response has JSON Body",- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {"," pm.response.to.have.jsonBody();","});","",@@ -6853,94 +13975,6 @@" );","}","",- "// Response body should have value \"requires_confirmation\" for \"status\"",- "if (jsonData?.status) {",- " pm.test(",- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",- " function () {",- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",- " },",- " );",- "}",- ""- ],- "type": "text/javascript"- }- }- ],- "request": {- "method": "GET",- "header": [- {- "key": "Accept",- "value": "application/json"- }- ],- "url": {- "raw": "{{baseUrl}}/payments/:id?force_sync=true",- "host": [- "{{baseUrl}}"- ],- "path": [- "payments",- ":id"- ],- "query": [- {- "key": "force_sync",- "value": "true"- }- ],- "variable": [- {- "key": "id",- "value": "{{payment_id}}",- "description": "(Required) unique payment id"- }- ]- },- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"- },- "response": []- },- {- "name": "Refunds - Create",- "event": [- {- "listen": "test",- "script": {- "exec": [- "// Validate status 4xx",- "pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {",- " pm.response.to.be.error;",- "});",- "",- "// Validate if response header has matching content-type",- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",- " \"application/json\",",- " );",- "});",- "",- "// Set response object as internal variable",- "let jsonData = {};",- "try {",- " jsonData = pm.response.json();",- "} catch (e) {}",- "",- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",- "if (jsonData?.refund_id) {",- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",- " console.log(",- " \"- use {{refund_id}} as collection variable for value\",",- " jsonData.refund_id,",- " );",- "} else {",- " console.log(",- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",- " );",- "}",- "","// Response body should have \"error\"","pm.test("," \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",@@ -6983,18 +14017,18 @@"language": "json"}},- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"+ "raw": "{\"amount\":8040,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"},"url": {- "raw": "{{baseUrl}}/refunds",+ "raw": "{{baseUrl}}/payments","host": ["{{baseUrl}}"],"path": [- "refunds"+ "payments"]},- "description": "To create a refund against an already processed payment"+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"},"response": []}@@ -7026,7 +14060,7 @@]},"info": {- "_postman_id": "4de44872-bdff-465f-a958-52988651e0b8",+ "_postman_id": "83b726fc-8895-4afd-8f07-a9545e209490","name": "nmi","description": "## Get started\n\nJuspay Router provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. \nYou can consume the APIs directly using your favorite HTTP/REST library. \nWe have a testing environment referred to \"sandbox\", which you can setup to test API calls without affecting production data.\n\n### Base URLs\n\nUse the following base URLs when making requests to the APIs:\n\n| Environment | Base URL |\n| --- | --- |\n| Sandbox | [https://sandbox.hyperswitch.io](https://sandbox.hyperswitch.io) |\n| Production | [https://router.juspay.io](https://router.juspay.io) |\n\n# Authentication\n\nWhen you sign up for an account, you are given a secret key (also referred as api-key). You may authenticate all API requests with Juspay server by providing the appropriate key in the request Authorization header. \nNever share your secret api keys. Keep them guarded and secure.\n\nContact Support: \nName: Juspay Support \nEmail: [[email protected]](mailto:[email protected])","schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",@@ -7086,6 +14120,11 @@"value": "","type": "string"},+ {+ "key": "connector_key1",+ "value": "",+ "type": "string"+ },{"key": "publishable_key","value": "",diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.jsonindex 23f922e137..7df7ba5158 100644--- a/postman/collection-json/stripe.postman_collection.json+++ b/postman/collection-json/stripe.postman_collection.json@@ -17960,7 +17960,7 @@"language": "json"}},- "raw": "{\"amount\":1000}"+ "raw": "{\"amount\":1000,\"amount_to_capture\":1000}"},"url": {"raw": "{{baseUrl}}/payments/:id",