Skip to content

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

ci(postman): fix bluesnap and checkout collections for saved card flow (#4071)

Pa1NarKa21d6d5e1673
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario10-Save card flow/Payments - Create/event.prerequest.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario10-Save card flow/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario10-Save card flow/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario11-Pass Invalid CVV for save card flow and verify failed payment Copy/Payments - Create/event.prerequest.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario11-Pass Invalid CVV for save card flow and verify failed payment Copy/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario11-Pass Invalid CVV for save card flow and verify failed payment Copy/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Create/event.prerequest.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario12-Save card payment with manual capture Copy/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment Copy/Payments - Create/event.prerequest.js b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment Copy/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/bluesnap/Flow Testcases/Happy Cases/Scenario13-Don't Pass CVV for save card flow and verify success payment Copy/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario11-Save card flow/Payments - Create/event.prerequest.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario11-Save card flow/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario11-Save card flow/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario12-Don't Pass CVV for save card flow and verify success payment/Payments - Create/event.prerequest.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario12-Don't Pass CVV for save card flow and verify success payment/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario12-Don't Pass CVV for save card flow and verify success payment/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario13-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.prerequest.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario13-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario13-Pass Invalid CVV for save card flow and verify failed payment/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/event.prerequest.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/event.prerequest.js
new file mode 100644
index 0000000000..27965bb9c0
--- /dev/null
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Create/event.prerequest.js
@@ -0,0 +1 @@
+pm.environment.set("random_number", _.random(1000, 100000));
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/.meta.json
index 035bfeded8..ad1de26c59 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/.meta.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/.meta.json
@@ -12,8 +12,8 @@
"Scenario8-Create a failure card payment with confirm true",
"Scenario9-Update amount with automatic capture",
"Scenario9a-Update amount with manual capture",
- "Scenario10-Create a mandate and recurring payment Copy",
- "Scenario11-Refund recurring payment Copy",
+ "Scenario10-Create a mandate and recurring payment",
+ "Scenario11-Refund recurring payment",
"Scenario12-Add card flow",
"Scenario13-Don't Pass CVV for save card flow and verify success payment",
"Scenario14-Save card payment with manual capture",
diff --git a/postman/collection-json/bluesnap.postman_collection.json b/postman/collection-json/bluesnap.postman_collection.json
index e8160e482f..137ccbe1a2 100644
--- a/postman/collection-json/bluesnap.postman_collection.json
+++ b/postman/collection-json/bluesnap.postman_collection.json
@@ -837,6 +837,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -1811,6 +1821,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -2444,6 +2464,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -3583,6 +3613,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
diff --git a/postman/collection-json/checkout.postman_collection.json b/postman/collection-json/checkout.postman_collection.json
index 0a1afbdd04..cdb94b4a84 100644
--- a/postman/collection-json/checkout.postman_collection.json
+++ b/postman/collection-json/checkout.postman_collection.json
@@ -899,6 +899,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -1906,6 +1916,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -2532,6 +2552,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -3176,6 +3206,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
diff --git a/postman/collection-json/nmi.postman_collection.json b/postman/collection-json/nmi.postman_collection.json
index d25030fad2..fa1dbac954 100644
--- a/postman/collection-json/nmi.postman_collection.json
+++ b/postman/collection-json/nmi.postman_collection.json
@@ -815,7 +815,7 @@
"name": "Happy Cases",
"item": [
{
- "name": "Scenario10-Create a mandate and recurring payment",
+ "name": "Scenario1-Create payment with confirm true",
"item": [
{
"name": "Payments - Create",
@@ -824,7 +824,7 @@
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -896,7 +896,7 @@
" );",
"}",
"",
- "// Response body should have value \"processing\" 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'\",",
@@ -905,22 +905,6 @@
" },",
" );",
"}",
- "",
- "// 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"
@@ -946,7 +930,7 @@
"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\"}}},\"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\"}},\"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\"}}"
+ "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",
@@ -1039,22 +1023,6 @@
" },",
" );",
"}",
- "",
- "// 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"
@@ -1095,15 +1063,20 @@
"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": "Recurring Payments - Create",
+ "name": "Payments - Create",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -1175,39 +1148,136 @@
" );",
"}",
"",
- "// Response body should have value \"processing\" 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\");",
" },",
" );",
"}",
+ ""
+ ],
+ "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 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",
+ "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 - Confirm",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
"",
- "// Response body should have \"mandate_id\"",
+ "// Validate if response header has matching content-type",
"pm.test(",
- " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
" function () {",
- " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
" },",
");",
"",
- "// 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;",
- " },",
- ");",
+ "// 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 \"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;",
- " },",
- ");",
+ "// 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/confirm - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -1215,6 +1285,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": [
{
@@ -1233,23 +1323,32 @@
"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\"}}"
+ "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": "Payments - Retrieve-copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
@@ -1317,31 +1416,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\");",
" },",
" );",
"}",
- "",
- "// 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"
@@ -1386,7 +1469,7 @@
]
},
{
- "name": "Scenario11-Refund recurring payment",
+ "name": "Scenario2a-Create payment with confirm false card holder name null",
"item": [
{
"name": "Payments - Create",
@@ -1395,7 +1478,7 @@
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -1405,9 +1488,6 @@
"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;",
@@ -1470,31 +1550,15 @@
" );",
"}",
"",
- "// Response body should have value \"processing\" 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\");",
" },",
" );",
"}",
- "",
- "// 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"
@@ -1520,7 +1584,7 @@
"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\"}}},\"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\"}},\"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\"}}"
+ "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",
@@ -1536,26 +1600,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();",
"});",
"",
@@ -1604,31 +1680,15 @@
" );",
"}",
"",
- "// 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\");",
" },",
" );",
"}",
- "",
- "// 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"
@@ -1636,27 +1696,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": [
{
@@ -1666,44 +1754,31 @@
}
]
},
- "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": "Recurring Payments - Create",
+ "name": "Payments - Retrieve",
"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.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();",
"});",
"",
@@ -1752,39 +1827,15 @@
" );",
"}",
"",
- "// Response body should have value \"processing\" 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'\",",
+ " \"[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;",
- " },",
- ");",
- "",
- "// 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"
@@ -1792,60 +1843,76 @@
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"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\",\"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",
+ "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": "Scenario2b-Create payment with confirm false card holder name empty",
+ "item": [
{
- "name": "Payments - Retrieve-copy",
+ "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(\"[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();",
"});",
"",
@@ -1894,31 +1961,15 @@
" );",
"}",
"",
- "// 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/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
- "",
- "// 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"
@@ -1926,42 +1977,41 @@
}
],
"request": {
- "method": "GET",
+ "method": "POST",
"header": [
{
- "key": "Accept",
+ "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/: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": "Refunds - Create",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "prerequest",
@@ -1976,19 +2026,24 @@
"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(\"[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.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",
@@ -1997,45 +2052,80 @@
" 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 \"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\");",
- " },",
+ "// 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 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 \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(amount);",
+ " 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": [
{
@@ -2054,91 +2144,108 @@
"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\"}}"
+ "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}}/refunds",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "description": "To create a refund against an already processed 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 - Retrieve",
+ "name": "Payments - 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]::/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 {{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 for \"refund_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 'refund_amount' matches '{{refund_amount}}'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(refund_amount);",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
- "}",
- ""
+ "}"
],
"type": "text/javascript"
}
@@ -2153,30 +2260,36 @@
}
],
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
+ "payments",
":id"
],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
"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": "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": "Scenario1-Create payment with confirm true",
+ "name": "Scenario3-Create payment without PMD",
"item": [
{
"name": "Payments - Create",
@@ -2257,12 +2370,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\");",
" },",
" );",
"}",
@@ -2291,7 +2404,7 @@
"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\"}}"
+ "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",
@@ -2307,26 +2420,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();",
"});",
"",
@@ -2375,12 +2500,12 @@
" );",
"}",
"",
- "// 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/confirm - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -2391,27 +2516,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": "{\"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}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
+ ":id",
+ "confirm"
],
"variable": [
{
@@ -2421,46 +2574,31 @@
}
]
},
- "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": "Scenario2-Create payment with confirm false",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Retrieve",
"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.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();",
"});",
"",
@@ -2509,12 +2647,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_confirmation\" 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_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\");",
" },",
" );",
"}",
@@ -2525,63 +2663,78 @@
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"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 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",
+ "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": "Scenario4-Create payment with Manual capture",
+ "item": [
{
- "name": "Payments - Confirm",
+ "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);",
+ "",
"// 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();",
"});",
"",
@@ -2630,10 +2783,10 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"requires_capture\" 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\");",
" },",
@@ -2646,26 +2799,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": [
{
@@ -2684,27 +2817,18 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\"}"
+ "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/: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": []
},
@@ -2780,9 +2904,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 - Content check if value for 'status' matches 'requires_capture'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
" },",
" );",
"}",
@@ -2826,20 +2950,14 @@
"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": "Scenario2a-Create payment with confirm false card holder name null",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Capture",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -2849,20 +2967,26 @@
"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 - Status code is 2xx\", function () {",
+ "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 - 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();",
"});",
"",
@@ -2911,142 +3035,32 @@
" );",
"}",
"",
- "// 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/capture - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " 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\":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 - 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 \"{{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 \"processing\" for \"status\"",
- "if (jsonData?.status) {",
+ "// Response body should have value \"{{amount}}\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
" },",
" );",
"}",
@@ -3057,26 +3071,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": [
{
@@ -3095,17 +3089,17 @@
"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\"}}"
+ "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments/:id/capture",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
":id",
- "confirm"
+ "capture"
],
"variable": [
{
@@ -3115,12 +3109,12 @@
}
]
},
- "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 capture the funds for an uncaptured payment"
},
"response": []
},
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Retrieve-copy",
"event": [
{
"listen": "test",
@@ -3191,7 +3185,7 @@
"// 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 - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
@@ -3241,7 +3235,7 @@
]
},
{
- "name": "Scenario2b-Create payment with confirm false card holder name empty",
+ "name": "Scenario5-Void the payment",
"item": [
{
"name": "Payments - Create",
@@ -3322,12 +3316,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "// Response body should have value \"requires_capture\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -3356,7 +3350,7 @@
"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\"}}"
+ "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",
@@ -3372,38 +3366,26 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Retrieve",
"event": [
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "type": "text/javascript"
- }
- },
{
"listen": "test",
"script": {
"exec": [
"// 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/: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();",
"});",
"",
@@ -3452,104 +3434,89 @@
" );",
"}",
"",
- "// Response body should have value \"processing\" for \"status\"",
+ "// Response body should have value \"cancelled\" 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 'requires_capture'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
" },",
" );",
- "}"
+ "}",
+ ""
],
"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",
+ "method": "GET",
"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\":\"\",\"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/confirm",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id",
- "confirm"
+ ":id"
],
- "variable": [
+ "query": [
{
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "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"
+ "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 - Retrieve",
+ "name": "Payments - Cancel",
"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/cancel - 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/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(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -3572,19 +3539,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);",
@@ -3598,42 +3552,51 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"cancelled\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
- "}"
+ "}",
+ ""
],
"type": "text/javascript"
}
}
],
"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": "{\"cancellation_reason\":\"user_cancel\"}"
+ },
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments/:id/cancel",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
+ ":id",
+ "cancel"
],
"variable": [
{
@@ -3643,46 +3606,31 @@
}
]
},
- "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": "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": "Scenario3-Create payment without PMD",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Retrieve-copy",
"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.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();",
"});",
"",
@@ -3731,12 +3679,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "// Response body should have value \"cancelled\" 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 'cancelled'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"cancelled\");",
" },",
" );",
"}",
@@ -3747,46 +3695,53 @@
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"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",
+ "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": "Scenario6-Refund full payment",
+ "item": [
{
- "name": "Payments - Confirm",
+ "name": "Payments - Create",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -3796,23 +3751,23 @@
"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();",
"});",
"",
@@ -3864,7 +3819,7 @@
"// 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 - Content check if value for 'status' matches 'processing'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
@@ -3877,26 +3832,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": [
{
@@ -3915,27 +3850,18 @@
"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\"}}}"
+ "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/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": []
},
@@ -4008,10 +3934,10 @@
" );",
"}",
"",
- "// 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\");",
" },",
@@ -4057,20 +3983,14 @@
"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": [
- "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -4080,76 +4000,56 @@
"listen": "test",
"script": {
"exec": [
- "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,",
- " );",
- "} 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,",
+ " \"- 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 '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);",
" },",
" );",
"}",
@@ -4178,96 +4078,78 @@
"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\"}}"
+ "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": "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 \"{{refund_amount}}\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{refund_amount}}'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.amount).to.eql(refund_amount);",
" },",
" );",
"}",
@@ -4286,39 +4168,39 @@
}
],
"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": "Scenario7-Partial refund",
+ "item": [
{
- "name": "Payments - Capture",
+ "name": "Payments - Create",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -4328,26 +4210,20 @@
"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();",
"});",
"",
@@ -4396,35 +4272,15 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// 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'\",",
+ " \"[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"
@@ -4450,32 +4306,23 @@
"language": "json"
}
},
- "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ "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",
@@ -4543,10 +4390,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\");",
" },",
@@ -4592,20 +4439,14 @@
"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",
+ "name": "Refunds - Create",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -4616,73 +4457,52 @@
"script": {
"exec": [
"// 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.\",",
+ "// 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 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\"",
+ "// Response body should have value \"540\" 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 '100'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.amount).to.eql(100);",
" },",
" );",
"}",
@@ -4711,96 +4531,75 @@
"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\"}}"
+ "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}}/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": "test",
"script": {
"exec": [
"// 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 \"cancelled\" for \"status\"",
+ "// Response body should have value \"6540\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '100'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.amount).to.eql(100);",
" },",
" );",
"}",
@@ -4819,34 +4618,28 @@
}
],
"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": "Payments - Cancel",
+ "name": "Refunds - Create-copy",
"event": [
{
"listen": "prerequest",
@@ -4862,23 +4655,15 @@
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/cancel - 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/: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",
@@ -4887,38 +4672,35 @@
" 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 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'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"pending\");",
+ " },",
" );",
"}",
"",
- "// Response body should have value \"cancelled\" for \"status\"",
+ "// Response body should have value \"1000\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.amount).to.eql(10);",
" },",
" );",
"}",
@@ -4947,27 +4729,110 @@
"language": "json"
}
},
- "raw": "{\"cancellation_reason\":\"user_cancel\"}"
+ "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}}/payments/:id/cancel",
+ "raw": "{{baseUrl}}/refunds",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "cancel"
+ "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": "{{payment_id}}",
- "description": "(Required) unique payment id"
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund 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"
+ "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": []
},
@@ -5040,15 +4905,20 @@
" );",
"}",
"",
- "// 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\");",
" },",
" );",
"}",
+ "",
+ "// 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"
@@ -5093,7 +4963,7 @@
]
},
{
- "name": "Scenario6-Refund full payment",
+ "name": "Scenario8-Create a failure card payment with confirm true",
"item": [
{
"name": "Payments - Create",
@@ -5112,9 +4982,6 @@
"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;",
@@ -5180,9 +5047,38 @@
"// Response body should have value \"succeeded\" 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 'failed'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " 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\");",
" },",
" );",
"}",
@@ -5211,7 +5107,7 @@
"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\"}}"
+ "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\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"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",
@@ -5229,6 +5125,15 @@
{
"name": "Payments - Retrieve",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -5298,9 +5203,38 @@
"// 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 'failed'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " 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\");",
" },",
" );",
"}",
@@ -5344,14 +5278,20 @@
"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": "Refunds - Create",
+ "name": "Payments - Create",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -5361,59 +5301,65 @@
"listen": "test",
"script": {
"exec": [
- "// Get the value of 'amount' from the environment",
- "const amount = pm.environment.get(\"amount\");",
+ "// 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]::/refunds - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// 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]::/refunds - 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 - 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) {}",
+ "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,",
- " );",
+ "// 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 {{refund_id}}, as jsonData.refund_id is undefined.\",",
- " );",
- "}",
+ " console.log('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\");",
- " },",
- " );",
- "}",
"",
- "// Response body should have value for \"amount\"",
+ "// 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]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(amount);",
- " },",
- " );",
- "}",
+ "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"
@@ -5439,81 +5385,70 @@
"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\"}}"
+ "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 - 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 refund_amount = pm.environment.get(\"amount\");",
+ "const updated_amount = pm.environment.get(\"amount\");",
"",
- "// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// 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(\"[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 - 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 - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
"",
- "// 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\");",
- " },",
- " );",
- "}",
+ "// 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);",
+ "});",
+ "",
"",
- "// 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"
@@ -5521,47 +5456,53 @@
}
],
"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\":\"{{another_random_number}}\",\"amount_to_capture\":\"{{another_random_number}}\"}"
+ },
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments/:id",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
+ "payments",
":id"
],
"variable": [
{
"key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
+ "value": "{{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": "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": "Scenario7-Partial refund",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(1000, 100000));",
""
],
"type": "text/javascript"
@@ -5571,77 +5512,45 @@
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
"",
- "// 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 status 2xx ",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
"});",
"",
- "// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ "// 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) {}",
+ "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.\",",
- " );",
- "}",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
"",
- "// 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 \"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\");",
+ "})};",
"",
- "// 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\");",
- " },",
- " );",
- "}",
+ "// 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"
@@ -5649,6 +5558,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": [
{
@@ -5658,6 +5587,12 @@
{
"key": "Accept",
"value": "application/json"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "text",
+ "disabled": true
}
],
"body": {
@@ -5667,99 +5602,109 @@
"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\"}}"
+ "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\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"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",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{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": "Payments - Retrieve",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
+ "// 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;",
+ " 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.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
"});",
"",
- "// Validate if response has JSON Body",
+ "// Validate if response has JSON Body ",
"pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ " pm.response.to.have.jsonBody();",
"});",
"",
"// Set response object as internal variable",
"let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
+ "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,",
- " );",
+ " 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.\",",
- " );",
- "}",
+ " 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,",
- " );",
+ " 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.\",",
- " );",
- "}",
+ " 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,",
- " );",
+ " 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.\",",
- " );",
- "}",
+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",
+ "};",
"",
- "// 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'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
+ "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"
@@ -5800,14 +5745,20 @@
"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": "Refunds - Create",
+ "name": "Payments - Create",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
""
],
"type": "text/javascript"
@@ -5817,56 +5768,65 @@
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// 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]::/refunds - 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 - 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) {}",
+ "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,",
- " );",
+ "// 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 {{refund_id}}, as jsonData.refund_id is undefined.\",",
- " );",
- "}",
+ " console.log('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\");",
- " },",
- " );",
- "}",
"",
- "// Response body should have value \"540\" for \"amount\"",
+ "// 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]::/refunds - Content check if value for 'amount' matches '100'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(100);",
- " },",
- " );",
- "}",
+ "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"
@@ -5892,78 +5852,70 @@
"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\":\"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}}/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 - 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": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// 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(\"[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 - 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 - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
"",
- "// 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\");",
- " },",
- " );",
- "}",
+ "// 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);",
+ "});",
+ "",
"",
- "// 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"
@@ -5971,36 +5923,48 @@
}
],
"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\":\"{{another_random_number}}\",\"amount_to_capture\":\"{{another_random_number}}\"}"
+ },
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments/:id",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
+ "payments",
":id"
],
"variable": [
{
"key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
+ "value": "{{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": "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": "Refunds - Create-copy",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "prerequest",
@@ -6015,56 +5979,45 @@
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// 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]::/refunds - 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\");",
"});",
"",
"// 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.\",",
- " );",
- "}",
+ "try {jsonData = pm.response.json();}catch(e){}",
"",
- "// 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\");",
- " },",
- " );",
- "}",
+ "// 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 \"1000\" for \"amount\"",
+ "//// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(10);",
- " },",
- " );",
- "}",
+ "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"
@@ -6072,6 +6025,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": [
{
@@ -6081,6 +6054,12 @@
{
"key": "Accept",
"value": "application/json"
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "text",
+ "disabled": true
}
],
"body": {
@@ -6090,78 +6069,109 @@
"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": "{\"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\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"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}}/refunds",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
]
},
- "description": "To create a refund against an already processed 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 - Retrieve-copy",
+ "name": "Payments - Retrieve",
"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;",
+ "// 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]::/refunds/:id - 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(\"[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) {}",
+ "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,",
- " );",
+ "// 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 {{refund_id}}, as jsonData.refund_id is undefined.\",",
- " );",
- "}",
+ " console.log('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\");",
- " },",
- " );",
- "}",
"",
- "// Response body should have value \"6540\" for \"amount\"",
+ "// 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'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(10);",
- " },",
- " );",
- "}",
+ "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"
@@ -6177,47 +6187,68 @@
}
],
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
+ "payments",
":id"
],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
"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": "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 - Retrieve-copy",
+ "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(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ "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(\"[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/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(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -6266,39 +6297,188 @@
" );",
"}",
"",
- "// 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/capture - 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 \"refunds\"",
- "pm.test(\"[POST]::/payments - Content check if 'refunds' exists\", function () {",
- " pm.expect(typeof jsonData.refunds !== \"undefined\").to.be.true;",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
"});",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
+ "",
+ "// 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"
@@ -6324,7 +6504,7 @@
]
},
{
- "name": "Scenario8-Create a failure card payment with confirm true",
+ "name": "Scenario10-Create a mandate and recurring payment",
"item": [
{
"name": "Payments - Create",
@@ -6333,7 +6513,7 @@
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
""
],
"type": "text/javascript"
@@ -6405,44 +6585,31 @@
" );",
"}",
"",
- "// 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 'failed'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"failed\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
"",
- "// Response body should have \"connector_transaction_id\"",
+ "// Response body should have \"mandate_id\"",
"pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
" function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
+ " pm.expect(typeof jsonData.mandate_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\");",
- " },",
- " );",
- "}",
+ "// 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"
@@ -6468,7 +6635,7 @@
"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\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"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\"}}"
+ "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\"}}},\"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\"}},\"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",
@@ -6486,15 +6653,6 @@
{
"name": "Payments - Retrieve",
"event": [
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "type": "text/javascript"
- }
- },
{
"listen": "test",
"script": {
@@ -6564,45 +6722,32 @@
"// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'failed'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"failed\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
"",
- "// Response body should have \"connector_transaction_id\"",
+ "// Response body should have \"mandate_id\"",
"pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
" function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
+ " pm.expect(typeof jsonData.mandate_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"
- }
+ "// 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"
+ }
}
],
"request": {
@@ -6639,20 +6784,15 @@
"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",
+ "name": "Recurring Payments - Create",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
""
],
"type": "text/javascript"
@@ -6662,256 +6802,101 @@
"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 ",
+ "// Validate status 2xx",
"pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ " 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.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
"});",
"",
- "// Validate if response has JSON Body ",
+ "// Validate if response has JSON Body",
"pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ " pm.response.to.have.jsonBody();",
"});",
"",
"// Set response object as internal variable",
"let jsonData = {};",
- "try {jsonData = pm.response.json();}catch(e){}",
+ "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);",
+ " 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.');",
- "};",
- "",
+ " 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);",
+ " 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.');",
- "};",
+ " 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);",
+ " 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 {{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}}\",\"amount_to_capture\":\"{{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();",
- "});",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
"",
- "//// Response body should have value \"processing\" 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'\", function() {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
- "})};",
+ " pm.test(",
+ " \"[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;",
+ " },",
+ ");",
"",
- "// 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 \"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 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);",
- "})};",
+ "// 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"
@@ -6919,26 +6904,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": [
{
@@ -6948,12 +6913,6 @@
{
"key": "Accept",
"value": "application/json"
- },
- {
- "key": "publishable_key",
- "value": "",
- "type": "text",
- "disabled": true
}
],
"body": {
@@ -6963,109 +6922,115 @@
"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\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"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\"}}"
+ "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}}"
- }
+ "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": "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 ",
+ "// Validate status 2xx",
"pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ " 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.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
"});",
"",
- "// Validate if response has JSON Body ",
+ "// Validate if response has JSON Body",
"pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ " pm.response.to.have.jsonBody();",
"});",
"",
"// Set response object as internal variable",
"let jsonData = {};",
- "try {jsonData = pm.response.json();}catch(e){}",
+ "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);",
+ " 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.');",
- "};",
- "",
+ " 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);",
+ " 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.');",
- "};",
+ " 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);",
+ " 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.');",
- "};",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
"",
- "//// 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'\", function() {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- "})};",
- "",
+ " pm.test(",
+ " \"[POST]::/payments/:id - 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 \"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 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);",
- "})};",
+ "// 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"
@@ -7110,7 +7075,7 @@
]
},
{
- "name": "Scenario9a-Update amount with manual capture",
+ "name": "Scenario11-Refund recurring payment",
"item": [
{
"name": "Payments - Create",
@@ -7132,62 +7097,93 @@
"// Set the environment variable 'amount' with the value from the response",
"pm.environment.set(\"amount\", pm.response.json().amount);",
"",
- "// Validate status 2xx ",
+ "// Validate status 2xx",
"pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ " 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.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
"});",
"",
- "// Validate if response has JSON Body ",
+ "// Validate if response has JSON Body",
"pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ " pm.response.to.have.jsonBody();",
"});",
"",
"// Set response object as internal variable",
"let jsonData = {};",
- "try {jsonData = pm.response.json();}catch(e){}",
+ "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);",
+ " 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.');",
- "};",
- "",
+ " 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);",
+ " 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.');",
- "};",
+ " 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);",
+ " 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.');",
- "};",
+ " 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\"",
+ "// Response body should have value \"processing\" 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\");",
- "})};",
+ " pm.test(",
+ " \"[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;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -7213,7 +7209,7 @@
"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\"}}"
+ "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\"}}},\"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\"}},\"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",
@@ -7229,54 +7225,99 @@
"response": []
},
{
- "name": "Payments - Update",
+ "name": "Payments - Retrieve",
"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 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 - 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 - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ "// 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) {}",
"",
- "// Parse the JSON response",
- "var jsonData = pm.response.json();",
+ "// 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.\",",
+ " );",
+ "}",
"",
- "// 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);",
- "});",
+ "// 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 \"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"
@@ -7284,28 +7325,15 @@
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"amount\":\"{{another_random_number}}\",\"amount_to_capture\":\"{{another_random_number}}\"}"
- },
"url": {
- "raw": "{{baseUrl}}/payments/:id",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
@@ -7313,24 +7341,32 @@
"payments",
":id"
],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
"variable": [
{
"key": "id",
- "value": "{{payment_id}}"
+ "value": "{{payment_id}}",
+ "description": "(Required) unique 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 "
+ "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"
@@ -7340,45 +7376,104 @@
"listen": "test",
"script": {
"exec": [
- "// Get the value of 'amount' from the environment",
- "const amount = pm.environment.get(\"amount\");",
+ "// 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.response.to.be.success;",
+ "// 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/: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 - 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){}",
+ "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();",
- "});",
+ "// 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.\",",
+ " );",
+ "}",
"",
- "//// Response body should have value \"processing\" for \"status\"",
+ "// 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\");",
- "})};",
+ " pm.test(",
+ " \"[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;",
+ " },",
+ ");",
"",
- "// 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 \"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 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);",
- "})};",
+ "// 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"
@@ -7386,26 +7481,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": [
{
@@ -7415,12 +7490,6 @@
{
"key": "Accept",
"value": "application/json"
- },
- {
- "key": "publishable_key",
- "value": "",
- "type": "text",
- "disabled": true
}
],
"body": {
@@ -7430,109 +7499,115 @@
"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\",\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"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\"}}"
+ "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}}"
- }
+ "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": "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 ",
+ "// Validate status 2xx",
"pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ " 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.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
"});",
"",
- "// Validate if response has JSON Body ",
+ "// Validate if response has JSON Body",
"pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ " pm.response.to.have.jsonBody();",
"});",
"",
"// Set response object as internal variable",
"let jsonData = {};",
- "try {jsonData = pm.response.json();}catch(e){}",
+ "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);",
+ " 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.');",
- "};",
- "",
+ " 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);",
+ " 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.');",
- "};",
+ " 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);",
+ " 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.');",
- "};",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
"",
- "//// 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'\", function() {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
- "})};",
- "",
+ " pm.test(",
+ " \"[POST]::/payments/:id - 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 \"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 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);",
- "})};",
+ "// 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"
@@ -7575,7 +7650,7 @@
"response": []
},
{
- "name": "Payments - Capture",
+ "name": "Refunds - Create",
"event": [
{
"listen": "prerequest",
@@ -7594,23 +7669,15 @@
"const amount = pm.environment.get(\"amount\");",
"",
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/capture - 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/: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();",
+ "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",
@@ -7619,76 +7686,35 @@
" 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);",
+ "// 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.\",",
" );",
"}",
"",
- "// Response body should have value \"processing\" for \"status\"",
+ "// Response body should have value \"pending\" 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}}'\",",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
" function () {",
- " pm.expect(jsonData.amount_received).to.eql(amount);",
+ " pm.expect(jsonData.status).to.eql(\"pending\");",
" },",
" );",
"}",
"",
- "// Response body should have value \"0\" for \"amount_capturable\"",
- "if (jsonData?.amount_capturable) {",
+ "// Response body should have value for \"amount\"",
+ "if (jsonData?.status) {",
" pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",
" function () {",
- " pm.expect(jsonData.amount_capturable).to.eql(amount);",
+ " pm.expect(jsonData.amount).to.eql(amount);",
" },",
" );",
"}",
@@ -7717,32 +7743,23 @@
"language": "json"
}
},
- "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ "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/:id/capture",
+ "raw": "{{baseUrl}}/refunds",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "capture"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "refunds"
]
},
- "description": "To capture the funds for an uncaptured payment"
+ "description": "To create a refund against an already processed payment"
},
"response": []
},
{
- "name": "Payments - Retrieve Copy",
+ "name": "Refunds - Retrieve",
"event": [
{
"listen": "prerequest",
@@ -7758,69 +7775,58 @@
"script": {
"exec": [
"// Get the value of 'amount' from the environment",
- "const amount = pm.environment.get(\"amount\");",
+ "const refund_amount = pm.environment.get(\"amount\");",
"",
- "// Validate status 2xx ",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// 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]::/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();",
+ "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 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.');",
- "};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
"",
- "// 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);",
+ "// 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 {{client_secret}}, as jsonData.client_secret is undefined.');",
- "};",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " );",
+ "}",
"",
- "//// 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'\", 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);",
- "});",
+ " 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 \"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);",
- "})};",
+ "// Response body should have value for \"refund_amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'refund_amount' matches '{{refund_amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(refund_amount);",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -7836,29 +7842,23 @@
}
],
"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": []
}