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): hotfix for stripe and nmi collections failing (#3956)

Pa1NarK1a8056799c7c
diff --git a/crates/test_utils/src/main.rs b/crates/test_utils/src/main.rs
index 006075895b..ba0d2eb358 100644
--- a/crates/test_utils/src/main.rs
+++ b/crates/test_utils/src/main.rs
@@ -18,17 +18,21 @@ fn main() {
// Filter out None values leaving behind Some(Path)
let paths: Vec<String> = runner.modified_file_paths.into_iter().flatten().collect();
- let git_status = Command::new("git").arg("restore").args(&paths).output();
- match git_status {
- Ok(output) => {
- if !output.status.success() {
+ if !paths.is_empty() {
+ let git_status = Command::new("git").arg("restore").args(&paths).output();
+
+ match git_status {
+ Ok(output) if !output.status.success() => {
let stderr_str = String::from_utf8_lossy(&output.stderr);
eprintln!("Git command failed with error: {stderr_str}");
}
- }
- Err(e) => {
- eprintln!("Error running Git: {e}");
+ Ok(_) => {
+ println!("Git restore successful!");
+ }
+ Err(e) => {
+ eprintln!("Error running Git: {e}");
+ }
}
}
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json
index 7b72495e5c..9699acd8bb 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9-Update amount with automatic capture/Payments - Confirm/request.json
@@ -29,7 +29,6 @@
"key": "Accept",
"value": "application/json"
},
- ,
{
"key": "publishable_key",
"value": "",
diff --git a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json
index 7b72495e5c..9699acd8bb 100644
--- a/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json
+++ b/postman/collection-dir/nmi/Flow Testcases/Happy Cases/Scenario9a-Update amount with manual capture/Payments - Confirm/request.json
@@ -29,7 +29,6 @@
"key": "Accept",
"value": "application/json"
},
- ,
{
"key": "publishable_key",
"value": "",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
index bfeee020b5..016af982e9 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/.meta.json
@@ -30,6 +30,10 @@
"Scenario24-Add card flow",
"Scenario25-Don't Pass CVV for save card flow and verifysuccess payment",
"Scenario26-Save card payment with manual capture",
- "Scenario27-Create payment without customer_id and with billing address and shipping address"
+ "Scenario27-Create payment without customer_id and with billing address and shipping address",
+ "Scenario28-Confirm a payment with requires_customer_action status",
+ "Scenario29-Create payment with payment method billing",
+ "Scenario30-Update payment with payment method billing",
+ "Scenario31-Pass payment method billing in Confirm"
]
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json
index 5a51941cf6..2b86201e2f 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario23- Update Amount/Payments - Confirm/request.json
@@ -29,7 +29,6 @@
"key": "Accept",
"value": "application/json"
},
- ,
{
"key": "publishable_key",
"value": "",
diff --git a/postman/collection-json/nmi.postman_collection.json b/postman/collection-json/nmi.postman_collection.json
index 3458081d48..89fd2e00d9 100644
--- a/postman/collection-json/nmi.postman_collection.json
+++ b/postman/collection-json/nmi.postman_collection.json
@@ -55,14 +55,7 @@
],
"request": {
"method": "GET",
- "header": [
- {
- "key": "x-feature",
- "value": "router-custom",
- "type": "text",
- "disabled": true
- }
- ],
+ "header": [],
"url": {
"raw": "{{baseUrl}}/health",
"host": [
@@ -6842,7 +6835,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":\"{{another_random_number}}\"}"
+ "raw": "{\"amount\":\"{{another_random_number}}\",\"amount_to_capture\":\"{{another_random_number}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id",
@@ -6956,12 +6949,6 @@
"key": "Accept",
"value": "application/json"
},
- {
- "key": "x-feature",
- "value": "router-custom",
- "type": "text",
- "disabled": true
- },
{
"key": "publishable_key",
"value": "",
@@ -7315,7 +7302,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":\"{{another_random_number}}\"}"
+ "raw": "{\"amount\":\"{{another_random_number}}\",\"amount_to_capture\":\"{{another_random_number}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id",
@@ -7429,12 +7416,6 @@
"key": "Accept",
"value": "application/json"
},
- {
- "key": "x-feature",
- "value": "router-custom",
- "type": "text",
- "disabled": true
- },
{
"key": "publishable_key",
"value": "",
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index 78a1777864..e245b07fb9 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -55,14 +55,7 @@
],
"request": {
"method": "GET",
- "header": [
- {
- "key": "x-feature",
- "value": "router-custom",
- "type": "text",
- "disabled": true
- }
- ],
+ "header": [],
"url": {
"raw": "{{baseUrl}}/health",
"host": [
@@ -6722,10 +6715,10 @@
]
},
{
- "name": "Scenario28-Confirm a payment with requires_customer_action status",
+ "name": "Scenario1-Create payment with confirm true",
"item": [
{
- "name": "Payments - Create with confirm true",
+ "name": "Payments - Create",
"event": [
{
"listen": "test",
@@ -6793,21 +6786,21 @@
" );",
"}",
"",
- "// Response body should have value \"requires_customer_action\" 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_customer_action'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
"",
- "// Response body should have \"next_action.redirect_to_url\"",
+ "// Response body should have \"connector_transaction_id\"",
"pm.test(",
- " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
" function () {",
- " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
" .true;",
" },",
");",
@@ -6836,7 +6829,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"business_country\":\"US\",\"business_label\":\"default\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -6852,15 +6845,15 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 400\", function () {",
- " pm.response.to.be.error;",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
@@ -6879,18 +6872,65 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) { }",
+ "} 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.\",",
+ " );",
+ "}",
"",
- "// Response body should have appropriatae error message",
- "if (jsonData?.message) {",
+ "// 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(",
- " \"Content check if appropriate error message is present\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.message).to.eql(\"You cannot confirm this payment because it has status requires_customer_action\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -6898,55 +6938,27 @@
}
],
"request": {
- "auth": {
- "type": "apikey",
- "apikey": [
- {
- "key": "value",
- "value": "{{publishable_key}}",
- "type": "string"
- },
- {
- "key": "key",
- "value": "api-key",
- "type": "string"
- },
- {
- "key": "in",
- "value": "header",
- "type": "string"
- }
- ]
- },
- "method": "POST",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"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"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
],
"variable": [
{
@@ -6956,14 +6968,14 @@
}
]
},
- "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": "Scenario29-Create payment with payment method billing",
+ "name": "Scenario2a-Create payment with confirm false card holder name null",
"item": [
{
"name": "Payments - Create",
@@ -6993,7 +7005,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) { }",
+ "} catch (e) {}",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -7034,33 +7046,24 @@
" );",
"}",
"",
- "// 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 '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 \"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 \"payment_method_data.billing\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
""
],
"type": "text/javascript"
@@ -7086,7 +7089,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -7102,26 +7105,29 @@
"response": []
},
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -7129,7 +7135,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) { }",
+ "} catch (e) {}",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -7170,33 +7176,24 @@
" );",
"}",
"",
- "// 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 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"connector_transaction_id\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
- "",
- "// Response body should have \"payment_method_data.billing\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
""
],
"type": "text/javascript"
@@ -7204,211 +7201,32 @@
}
],
"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": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
- },
- "response": []
- }
- ]
- },
- {
- "name": "Scenario30-Update payment with payment method billing",
- "item": [
- {
- "name": "Payments - Create",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) { }",
- "",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(",
- " \"- use {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
- " console.log(",
- " \"- use {{client_secret}} as collection variable for value\",",
- " jsonData.client_secret,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
- " );",
- "}",
- "",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
- " },",
- " );",
- "}",
- ""
- ],
- "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\":6540,\"currency\":\"USD\",\"confirm\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"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\",\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
- },
- "response": []
- },
- {
- "name": "Payments - Update",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) { }",
- "",
- "// Response body should have value \"requires_confirmation\" 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_confirmation\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have \"payment_method_data.billing\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
@@ -7421,25 +7239,27 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"card\",\"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\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}}}"
+ "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"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",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id"
+ ":id",
+ "confirm"
],
"variable": [
{
"key": "id",
- "value": "{{payment_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": []
},
@@ -7471,7 +7291,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) { }",
+ "} catch (e) {}",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -7512,24 +7332,15 @@
" );",
"}",
"",
- "// Response body should have value \"requires_confirmation\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"payment_method_data.billing\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
""
],
"type": "text/javascript"
@@ -7574,7 +7385,7 @@
]
},
{
- "name": "Scenario31-Pass payment method billing in Confirm",
+ "name": "Scenario2b-Create payment with confirm false card holder name empty",
"item": [
{
"name": "Payments - Create",
@@ -7711,7 +7522,7 @@
"script": {
"exec": [
"// 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;",
"});",
"",
@@ -7783,8 +7594,7 @@
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
- "}",
- ""
+ "}"
],
"type": "text/javascript"
}
@@ -7838,7 +7648,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"card_cvc\":\"123\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}},\"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": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"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",
@@ -7890,7 +7700,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) { }",
+ "} catch (e) {}",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -7939,17 +7749,7 @@
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
- "}",
- "",
- "// Response body should have \"payment_method_data.billing\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
- ""
+ "}"
],
"type": "text/javascript"
}
@@ -7993,7 +7793,7 @@
]
},
{
- "name": "Scenario1-Create payment with confirm true",
+ "name": "Scenario3-Create payment without PMD",
"item": [
{
"name": "Payments - Create",
@@ -8064,24 +7864,144 @@
" );",
"}",
"",
- "// 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 '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\");",
" },",
" );",
"}",
+ ""
+ ],
+ "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\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - 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 \"connector_transaction_id\"",
+ "// Validate if response header has matching content-type",
"pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
" function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
+ " 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 \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/confirm - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
""
],
"type": "text/javascript"
@@ -8089,6 +8009,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": [
{
@@ -8107,18 +8047,27 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"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": []
},
@@ -8191,24 +8140,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 \"connector_transaction_id\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
""
],
"type": "text/javascript"
@@ -8253,7 +8193,7 @@
]
},
{
- "name": "Scenario2a-Create payment with confirm false card holder name null",
+ "name": "Scenario4-Create payment with Manual capture",
"item": [
{
"name": "Payments - Create",
@@ -8324,12 +8264,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 'requires_capture'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
" },",
" );",
"}",
@@ -8337,15 +8277,6 @@
],
"type": "text/javascript"
}
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "type": "text/javascript"
- }
}
],
"request": {
@@ -8367,7 +8298,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -8383,20 +8314,20 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Capture",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - 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/:id/confirm - Content-Type is application/json\",",
+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
" function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
@@ -8405,7 +8336,7 @@
");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -8457,21 +8388,32 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- ""
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6000\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(6540);",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -8479,26 +8421,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": [
{
@@ -8517,17 +8439,17 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"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\":6540,\"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": [
{
@@ -8537,7 +8459,7 @@
}
]
},
- "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": []
},
@@ -8613,7 +8535,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\");",
" },",
@@ -8663,7 +8585,7 @@
]
},
{
- "name": "Scenario2b-Create payment with confirm false card holder name empty",
+ "name": "Scenario4a-Create payment with manual_multiple capture",
"item": [
{
"name": "Payments - Create",
@@ -8734,12 +8656,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 'requires_capture'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
" },",
" );",
"}",
@@ -8747,15 +8669,6 @@
],
"type": "text/javascript"
}
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "type": "text/javascript"
- }
}
],
"request": {
@@ -8777,7 +8690,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -8793,20 +8706,20 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Capture",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// 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/:id/confirm - Content-Type is application/json\",",
+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
" function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
@@ -8815,7 +8728,7 @@
");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -8867,20 +8780,32 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
- "}"
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6000\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(6000);",
+ " },",
+ " );",
+ "}",
""
],
"type": "text/javascript"
@@ -8888,26 +8813,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": [
{
@@ -8926,17 +8831,17 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"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\"}}"
+ "raw": "{\"amount_to_capture\":6000,\"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": [
{
@@ -8946,7 +8851,7 @@
}
]
},
- "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": []
},
@@ -9022,12 +8927,13 @@
"// 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 'partially_captured'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
" },",
" );",
- "}"
+ "}",
+ ""
],
"type": "text/javascript"
}
@@ -9071,7 +8977,7 @@
]
},
{
- "name": "Scenario3-Create payment without PMD",
+ "name": "Scenario5-Void the payment",
"item": [
{
"name": "Payments - Create",
@@ -9142,12 +9048,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 'requires_capture'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
" },",
" );",
"}",
@@ -9176,7 +9082,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -9192,20 +9098,20 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Cancel",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - 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(",
- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
+ " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",
" function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
@@ -9214,7 +9120,7 @@
");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -9237,19 +9143,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);",
@@ -9262,12 +9155,13 @@
" \"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 \"cancelled\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments:id/confirm - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'cancelled'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"cancelled\");",
" },",
" );",
"}",
@@ -9275,38 +9169,9 @@
],
"type": "text/javascript"
}
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "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": [
{
@@ -9325,17 +9190,17 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"cancellation_reason\":\"requested_by_customer\"}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments/:id/cancel",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
":id",
- "confirm"
+ "cancel"
],
"variable": [
{
@@ -9345,7 +9210,7 @@
}
]
},
- "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": "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": []
},
@@ -9418,12 +9283,12 @@
" );",
"}",
"",
- "// 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 - Content check if value for 'status' matches 'cancelled'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"cancelled\");",
" },",
" );",
"}",
@@ -9471,7 +9336,7 @@
]
},
{
- "name": "Scenario4-Create payment with Manual capture",
+ "name": "Scenario6-Create 3DS payment",
"item": [
{
"name": "Payments - Create",
@@ -9542,15 +9407,24 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"next_action.redirect_to_url\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -9576,7 +9450,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"business_country\":\"US\",\"business_label\":\"default\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -9592,29 +9466,26 @@
"response": []
},
{
- "name": "Payments - Capture",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/capture - 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/capture - 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/capture - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -9663,32 +9534,12 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]:://payments/:id/capture - 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?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"6000\" for \"amount_received\"",
- "if (jsonData?.amount_received) {",
- " pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.amount_received).to.eql(6540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
@@ -9699,137 +9550,10 @@
}
],
"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_to_capture\":6540,\"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",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
- "",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(",
- " \"- use {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
- "if (jsonData?.mandate_id) {",
- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
- " console.log(",
- " \"- use {{mandate_id}} as collection variable for value\",",
- " jsonData.mandate_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
- " console.log(",
- " \"- use {{client_secret}} as collection variable for value\",",
- " jsonData.client_secret,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
- " );",
- "}",
- "",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
+ "key": "Accept",
"value": "application/json"
}
],
@@ -9863,7 +9587,7 @@
]
},
{
- "name": "Scenario4a-Create payment with manual_multiple capture",
+ "name": "Scenario7-Create 3DS payment with confrm false",
"item": [
{
"name": "Payments - Create",
@@ -9934,12 +9658,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"requires_confirmation\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
" },",
" );",
"}",
@@ -9968,7 +9692,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -9984,20 +9708,20 @@
"response": []
},
{
- "name": "Payments - Capture",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/capture - 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(",
- " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
" function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
@@ -10006,7 +9730,7 @@
");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -10055,35 +9779,33 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"6540\" for \"amount\"",
- "if (jsonData?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
"",
- "// Response body should have value \"6000\" for \"amount_received\"",
- "if (jsonData?.amount_received) {",
- " pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
- " function () {",
- " pm.expect(jsonData.amount_received).to.eql(6000);",
- " },",
- " );",
- "}",
+ "// Response body should have \"next_action.redirect_to_url\"",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if 'next_action.redirect_to_url' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
""
],
"type": "text/javascript"
@@ -10091,6 +9813,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": [
{
@@ -10109,17 +9851,17 @@
"language": "json"
}
},
- "raw": "{\"amount_to_capture\":6000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/capture",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
":id",
- "capture"
+ "confirm"
],
"variable": [
{
@@ -10129,7 +9871,7 @@
}
]
},
- "description": "To capture the funds for an uncaptured 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": []
},
@@ -10202,12 +9944,12 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'partially_captured'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"partially_captured\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
@@ -10255,7 +9997,7 @@
]
},
{
- "name": "Scenario5-Void the payment",
+ "name": "Scenario8-Create a failure card payment with confirm true",
"item": [
{
"name": "Payments - Create",
@@ -10326,120 +10068,41 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'failed'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.status).to.eql(\"failed\");",
" },",
" );",
"}",
- ""
- ],
- "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\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
- },
- "response": []
- },
- {
- "name": "Payments - Cancel",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/cancel - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
"",
- "// Validate if response header has matching content-type",
+ "// Response body should have \"connector_transaction_id\"",
"pm.test(",
- " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
" function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
" },",
");",
"",
- "// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
- "",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(",
- " \"- use {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
- " console.log(",
- " \"- use {{client_secret}} as collection variable for value\",",
- " jsonData.client_secret,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ "// Response body should have value \"card_declined\" for \"error_code\"",
+ "if (jsonData?.error_code) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches 'card_declined'\",",
+ " function () {",
+ " pm.expect(jsonData.error_code).to.eql(\"card_declined\");",
+ " },",
" );",
"}",
"",
- "// Response body should have value \"cancelled\" for \"status\"",
- "if (jsonData?.status) {",
+ "// Response body should have value \"message - Your card has insufficient funds., decline_code - insufficient_funds\" for \"error_message\"",
+ "if (jsonData?.error_message) {",
" pm.test(",
- " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'cancelled'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'message - Your card has insufficient funds., decline_code - insufficient_funds'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"cancelled\");",
+ " pm.expect(jsonData.error_message).to.eql(\"message - Your card has insufficient funds., decline_code - insufficient_funds\");",
" },",
" );",
"}",
@@ -10468,27 +10131,18 @@
"language": "json"
}
},
- "raw": "{\"cancellation_reason\":\"requested_by_customer\"}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000009995\",\"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\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/cancel",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "cancel"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "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 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": []
},
@@ -10561,12 +10215,41 @@
" );",
"}",
"",
- "// 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 'failed'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"cancelled\");",
+ " 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 \"card_declined\" for \"error_code\"",
+ "if (jsonData?.error_code) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches 'card_declined'\",",
+ " function () {",
+ " pm.expect(jsonData.error_code).to.eql(\"card_declined\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"message - Your card has insufficient funds., decline_code - insufficient_funds\" for \"error_message\"",
+ "if (jsonData?.error_message) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'message - Your card has insufficient funds., decline_code - insufficient_funds'\",",
+ " function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"message - Your card has insufficient funds., decline_code - insufficient_funds\");",
" },",
" );",
"}",
@@ -10614,7 +10297,7 @@
]
},
{
- "name": "Scenario6-Create 3DS payment",
+ "name": "Scenario9-Refund full payment",
"item": [
{
"name": "Payments - Create",
@@ -10685,24 +10368,15 @@
" );",
"}",
"",
- "// Response body should have value \"requires_customer_action\" 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_customer_action'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"next_action.redirect_to_url\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
""
],
"type": "text/javascript"
@@ -10728,7 +10402,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"business_country\":\"US\",\"business_label\":\"default\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -10812,12 +10486,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_customer_action\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
@@ -10861,87 +10535,61 @@
"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": "Scenario7-Create 3DS payment with confrm false",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Refunds - Create",
"event": [
{
"listen": "test",
"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);",
- " 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 \"requires_confirmation\" for \"status\"",
+ "// Response body should have value \"6540\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
+ " pm.expect(jsonData.amount).to.eql(6540);",
" },",
" );",
"}",
@@ -10970,46 +10618,38 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":6540,\"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 - Confirm",
+ "name": "Refunds - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - 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(",
- " \"[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();",
+ "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",
@@ -11018,216 +10658,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 \"requires_customer_action\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
"",
- "// Response body should have \"next_action.redirect_to_url\"",
- "pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if 'next_action.redirect_to_url' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
- ""
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "auth": {
- "type": "apikey",
- "apikey": [
- {
- "key": "value",
- "value": "{{publishable_key}}",
- "type": "string"
- },
- {
- "key": "key",
- "value": "api-key",
- "type": "string"
- },
- {
- "key": "in",
- "value": "header",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"client_secret\":\"{{client_secret}}\"}"
- },
- "url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id",
- "confirm"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
- },
- "response": []
- },
- {
- "name": "Payments - Retrieve",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
- "",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(",
- " \"- use {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
- "if (jsonData?.mandate_id) {",
- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
- " console.log(",
- " \"- use {{mandate_id}} as collection variable for value\",",
- " jsonData.mandate_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
- " console.log(",
- " \"- use {{client_secret}} as collection variable for value\",",
- " jsonData.client_secret,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
- " );",
- "}",
- "",
- "// Response body should have value \"requires_customer_action\" 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_customer_action'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " pm.expect(jsonData.amount).to.eql(6540);",
" },",
" );",
"}",
@@ -11246,36 +10705,30 @@
}
],
"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": "Scenario8-Create a failure card payment with confirm true",
+ "name": "Scenario9a-Partial refund",
"item": [
{
"name": "Payments - Create",
@@ -11349,38 +10802,9 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'failed'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"failed\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have \"connector_transaction_id\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
- "",
- "// Response body should have value \"card_declined\" for \"error_code\"",
- "if (jsonData?.error_code) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches 'card_declined'\",",
- " function () {",
- " pm.expect(jsonData.error_code).to.eql(\"card_declined\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"message - Your card has insufficient funds., decline_code - insufficient_funds\" for \"error_message\"",
- "if (jsonData?.error_message) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'message - Your card has insufficient funds., decline_code - insufficient_funds'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.error_message).to.eql(\"message - Your card has insufficient funds., decline_code - insufficient_funds\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
@@ -11409,7 +10833,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000009995\",\"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\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -11496,38 +10920,9 @@
"// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'failed'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"failed\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have \"connector_transaction_id\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
- "",
- "// Response body should have value \"card_declined\" for \"error_code\"",
- "if (jsonData?.error_code) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches 'card_declined'\",",
- " function () {",
- " pm.expect(jsonData.error_code).to.eql(\"card_declined\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"message - Your card has insufficient funds., decline_code - insufficient_funds\" for \"error_message\"",
- "if (jsonData?.error_message) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'message - Your card has insufficient funds., decline_code - insufficient_funds'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.error_message).to.eql(\"message - Your card has insufficient funds., decline_code - insufficient_funds\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
@@ -11571,87 +10966,61 @@
"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-Refund full payment",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Refunds - Create",
"event": [
{
"listen": "test",
"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);",
- " 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 \"540\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.amount).to.eql(540);",
" },",
" );",
"}",
@@ -11680,96 +11049,75 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
- "raw": "{{baseUrl}}/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 \"Succeeded\" 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 'succeeded'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.amount).to.eql(540);",
" },",
" );",
"}",
@@ -11788,34 +11136,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": "Refunds - Create",
+ "name": "Refunds - Create-copy",
"event": [
{
"listen": "test",
@@ -11862,12 +11204,12 @@
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount\"",
+ "// Response body should have value \"1000\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '1000'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
+ " pm.expect(jsonData.amount).to.eql(1000);",
" },",
" );",
"}",
@@ -11896,7 +11238,7 @@
"language": "json"
}
},
- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":6540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":1000,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/refunds",
@@ -11912,7 +11254,7 @@
"response": []
},
{
- "name": "Refunds - Retrieve",
+ "name": "Refunds - Retrieve-copy",
"event": [
{
"listen": "test",
@@ -11962,9 +11304,9 @@
"// Response body should have value \"6540\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '1000'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
+ " pm.expect(jsonData.amount).to.eql(1000);",
" },",
" );",
"}",
@@ -12002,33 +11344,28 @@
"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": "Scenario9a-Partial refund",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Retrieve-copy",
"event": [
{
"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();",
"});",
"",
@@ -12077,15 +11414,20 @@
" );",
"}",
"",
- "// 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\");",
" },",
" );",
"}",
+ "",
+ "// 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"
@@ -12093,60 +11435,66 @@
}
],
"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\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
- },
"url": {
- "raw": "{{baseUrl}}/payments",
+ "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": "Scenario10-Create a mandate and recurring payment",
+ "item": [
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Create",
"event": [
{
"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();",
"});",
"",
@@ -12195,113 +11543,41 @@
" );",
"}",
"",
- "// 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 - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
- },
- "response": []
- },
- {
- "name": "Refunds - Create",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
- "",
- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
- " console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
- " );",
- "}",
"",
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
"",
- "// Response body should have value \"540\" for \"amount\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(540);",
- " },",
- " );",
- "}",
+ "// 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"
@@ -12327,78 +11603,115 @@
"language": "json"
}
},
- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
- "raw": "{{baseUrl}}/refunds",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments"
]
},
- "description": "To create a refund against an already processed payment"
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
},
"response": []
},
{
- "name": "Refunds - Retrieve",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
" );",
"});",
"",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
"// Set response object as internal variable",
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
"} catch (e) {}",
"",
- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
" console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount\"",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(540);",
+ " 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"
@@ -12414,180 +11727,134 @@
}
],
"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": "Refunds - Create-copy",
+ "name": "Recurring Payments - Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
" );",
"});",
"",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
"// Set response object as internal variable",
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
"} catch (e) {}",
"",
- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
" console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
- " );",
- "}",
- "",
- "// 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\");",
- " },",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"1000\" for \"amount\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '1000'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(1000);",
- " },",
+ "// 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,",
" );",
- "}",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":1000,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
- },
- "url": {
- "raw": "{{baseUrl}}/refunds",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "refunds"
- ]
- },
- "description": "To create a refund against an already processed payment"
- },
- "response": []
- },
- {
- "name": "Refunds - Retrieve-copy",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
- "});",
- "",
- "// 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 client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
" console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
" );",
"}",
"",
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments - 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 '1000'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(1000);",
- " },",
- " );",
- "}",
+ "// 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"
@@ -12595,31 +11862,36 @@
}
],
"request": {
- "method": "GET",
+ "method": "POST",
"header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
}
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"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\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
- }
+ "payments"
]
},
- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
},
"response": []
},
@@ -12702,10 +11974,21 @@
" );",
"}",
"",
- "// Response body should have \"refunds\"",
- "pm.test(\"[POST]::/payments - Content check if 'refunds' exists\", function () {",
- " pm.expect(typeof jsonData.refunds !== \"undefined\").to.be.true;",
- "});",
+ "// 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"
@@ -12750,7 +12033,7 @@
]
},
{
- "name": "Scenario10-Create a mandate and recurring payment",
+ "name": "Scenario11-Refund recurring payment",
"item": [
{
"name": "Payments - Create",
@@ -12881,7 +12164,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -13110,6 +12393,16 @@
" );",
"}",
"",
+ "// 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\");",
+ " },",
+ " );",
+ "}",
+ "",
"// Response body should have \"mandate_id\"",
"pm.test(",
" \"[POST]::/payments - Content check if 'mandate_id' exists\",",
@@ -13158,7 +12451,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"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\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6570,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6570,\"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\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -13307,116 +12600,64 @@
"description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
},
"response": []
- }
- ]
- },
- {
- "name": "Scenario11-Refund recurring payment",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Refunds - Create Copy",
"event": [
{
"listen": "test",
"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);",
- " 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 \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[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 \"6540\" for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.amount).to.eql(6540);",
" },",
" );",
"}",
- "",
- "// 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"
@@ -13442,115 +12683,78 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":6540,\"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 Copy",
"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 \"Succeeded\" 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 'succeeded'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.amount).to.eql(6540);",
" },",
" );",
"}",
- "",
- "// 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"
@@ -13566,34 +12770,33 @@
}
],
"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": "Scenario12-BNPL-klarna",
+ "item": [
{
- "name": "Recurring Payments - Create",
+ "name": "Payments - Create",
"event": [
{
"listen": "test",
@@ -13661,49 +12864,15 @@
" );",
"}",
"",
- "// 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\");",
- " },",
- " );",
- "}",
- "",
- "// 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 '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;",
- " },",
- ");",
- "",
- "// 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"
@@ -13729,7 +12898,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6570,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6570,\"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\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":8000,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":8000,\"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\",\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -13745,26 +12914,29 @@
"response": []
},
{
- "name": "Payments - Retrieve-copy",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -13813,31 +12985,53 @@
" );",
"}",
"",
- "// Response body should have value \"Succeeded\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" 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 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
"",
- "// Response body should have \"mandate_id\"",
+ "// Response body should have \"next_action.redirect_to_url\"",
"pm.test(",
- " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
" function () {",
- " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"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 value \"klarna\" for \"payment_method_type\"",
+ "if (jsonData?.payment_method_type) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'klarna'\",",
+ " function () {",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"klarna\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"stripe\" for \"connector\"",
+ "if (jsonData?.connector) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
+ " function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
""
],
"type": "text/javascript"
@@ -13845,27 +13039,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": "Accept",
+ "key": "Content-Type",
"value": "application/json"
- }
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"payment_method\":\"pay_later\",\"payment_method_type\":\"klarna\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"klarna_redirect\":{\"issuer_name\":\"stripe\",\"billing_email\":\"[email protected]\",\"billing_country\":\"US\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ },
"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": [
{
@@ -13875,161 +13097,85 @@
}
]
},
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
},
"response": []
},
{
- "name": "Refunds - Create Copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
" );",
"});",
"",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
"// Set response object as internal variable",
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
"} catch (e) {}",
"",
- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
" console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// 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,",
" );",
- "}",
- "",
- "// Response body should have value \"6540\" for \"amount\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
- " },",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
"}",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":6540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
- },
- "url": {
- "raw": "{{baseUrl}}/refunds",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "refunds"
- ]
- },
- "description": "To create a refund against an already processed payment"
- },
- "response": []
- },
- {
- "name": "Refunds - Retrieve Copy",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
"",
- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
" console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
- " );",
- "}",
- "",
- "// 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\");",
- " },",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount\"",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '6540'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
@@ -14048,30 +13194,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": "Scenario12-BNPL-klarna",
+ "name": "Scenario13-BNPL-afterpay",
"item": [
{
"name": "Payments - Create",
@@ -14176,7 +13328,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":8000,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":8000,\"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\",\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":7000,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"SE\"}},\"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\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"SE\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -14282,12 +13434,12 @@
" },",
");",
"",
- "// Response body should have value \"klarna\" for \"payment_method_type\"",
+ "// Response body should have value \"afterpay_clearpay\" for \"payment_method_type\"",
"if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'klarna'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'afterpay_clearpay'\",",
" function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"klarna\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"afterpay_clearpay\");",
" },",
" );",
"}",
@@ -14355,7 +13507,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"pay_later\",\"payment_method_type\":\"klarna\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"klarna_redirect\":{\"issuer_name\":\"stripe\",\"billing_email\":\"[email protected]\",\"billing_country\":\"US\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"payment_method\":\"pay_later\",\"payment_method_type\":\"afterpay_clearpay\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"afterpay_clearpay_redirect\":{\"billing_name\":\"Akshaya\",\"billing_email\":\"[email protected]\"}}},\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -14501,7 +13653,7 @@
]
},
{
- "name": "Scenario13-BNPL-afterpay",
+ "name": "Scenario14-BNPL-affirm",
"item": [
{
"name": "Payments - Create",
@@ -14606,7 +13758,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":7000,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"SE\"}},\"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\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"SE\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":7000,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"US\"}},\"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\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -14712,12 +13864,12 @@
" },",
");",
"",
- "// Response body should have value \"afterpay_clearpay\" for \"payment_method_type\"",
+ "// Response body should have value \"affirm\" for \"payment_method_type\"",
"if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'afterpay_clearpay'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'affirm'\",",
" function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"afterpay_clearpay\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"affirm\");",
" },",
" );",
"}",
@@ -14785,7 +13937,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"pay_later\",\"payment_method_type\":\"afterpay_clearpay\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"afterpay_clearpay_redirect\":{\"billing_name\":\"Akshaya\",\"billing_email\":\"[email protected]\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"payment_method\":\"pay_later\",\"payment_method_type\":\"affirm\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"affirm_redirect\":{\"issuer_name\":\"affirm\",\"billing_email\":\"[email protected]\",\"billing_country\":\"US\"}}},\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -14931,7 +14083,7 @@
]
},
{
- "name": "Scenario14-BNPL-affirm",
+ "name": "Scenario15-Bank Redirect-Ideal",
"item": [
{
"name": "Payments - Create",
@@ -15036,7 +14188,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":7000,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"country\":\"US\"}},\"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\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"order_details\":{\"product_name\":\"Socks\",\"amount\":7000,\"quantity\":1}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":1000,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":1000,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"first_name\":\"John\",\"last_name\":\"Doe\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"DE\"}},\"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\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -15142,12 +14294,12 @@
" },",
");",
"",
- "// Response body should have value \"affirm\" for \"payment_method_type\"",
+ "// Response body should have value \"ideal\" for \"payment_method_type\"",
"if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'affirm'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'ideal'\",",
" function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"affirm\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"ideal\");",
" },",
" );",
"}",
@@ -15215,7 +14367,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"pay_later\",\"payment_method_type\":\"affirm\",\"payment_experience\":\"redirect_to_url\",\"payment_method_data\":{\"pay_later\":{\"affirm_redirect\":{\"issuer_name\":\"affirm\",\"billing_email\":\"[email protected]\",\"billing_country\":\"US\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -15361,7 +14513,7 @@
]
},
{
- "name": "Scenario15-Bank Redirect-Ideal",
+ "name": "Scenario16-Bank Redirect-sofort",
"item": [
{
"name": "Payments - Create",
@@ -15572,12 +14724,12 @@
" },",
");",
"",
- "// Response body should have value \"ideal\" for \"payment_method_type\"",
+ "// Response body should have value \"sofort\" for \"payment_method_type\"",
"if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'ideal'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'sofort'\",",
" function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"ideal\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"sofort\");",
" },",
" );",
"}",
@@ -15645,7 +14797,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"ing\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"sofort\",\"payment_method_data\":{\"bank_redirect\":{\"sofort\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"hypo_noe_lb_fur_niederosterreich_u_wien\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -15791,7 +14943,7 @@
]
},
{
- "name": "Scenario16-Bank Redirect-sofort",
+ "name": "Scenario17-Bank Redirect-eps",
"item": [
{
"name": "Payments - Create",
@@ -16002,12 +15154,12 @@
" },",
");",
"",
- "// Response body should have value \"sofort\" for \"payment_method_type\"",
+ "// Response body should have value \"eps\" for \"payment_method_type\"",
"if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'sofort'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'eps'\",",
" function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"sofort\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"eps\");",
" },",
" );",
"}",
@@ -16075,7 +15227,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"sofort\",\"payment_method_data\":{\"bank_redirect\":{\"sofort\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"hypo_noe_lb_fur_niederosterreich_u_wien\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"eps\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"hypo_oberosterreich_salzburg_steiermark\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -16221,7 +15373,7 @@
]
},
{
- "name": "Scenario17-Bank Redirect-eps",
+ "name": "Scenario18-Bank Redirect-giropay",
"item": [
{
"name": "Payments - Create",
@@ -16432,12 +15584,12 @@
" },",
");",
"",
- "// Response body should have value \"eps\" for \"payment_method_type\"",
+ "// Response body should have value \"giropay\" for \"payment_method_type\"",
"if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'eps'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'giropay'\",",
" function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"eps\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"giropay\");",
" },",
" );",
"}",
@@ -16505,7 +15657,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"eps\",\"payment_method_data\":{\"bank_redirect\":{\"eps\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"hypo_oberosterreich_salzburg_steiermark\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"giropay\",\"payment_method_data\":{\"bank_redirect\":{\"giropay\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -16651,7 +15803,7 @@
]
},
{
- "name": "Scenario18-Bank Redirect-giropay",
+ "name": "Scenario19-Bank Transfer-ach",
"item": [
{
"name": "Payments - Create",
@@ -16756,7 +15908,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":1000,\"currency\":\"EUR\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":1000,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"first_name\":\"John\",\"last_name\":\"Doe\",\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"DE\"}},\"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\":\"127.0.0.1\"},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"Doe\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":800,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":800,\"customer_id\":\"poll\",\"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://hs-payments-test.netlify.app/payments\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -16853,21 +16005,32 @@
" );",
"}",
"",
- "// Response body should have \"next_action.redirect_to_url\"",
+ "// Response body should have \"next_action.type\"",
"pm.test(",
- " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
+ " \"[POST]::/payments - Content check if 'next_action.type' exists\",",
" function () {",
- " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
- " .true;",
+ " pm.expect(typeof jsonData.next_action.type !== \"undefined\").to.be.true;",
" },",
");",
"",
- "// Response body should have value \"giropay\" for \"payment_method_type\"",
+ "// Response body should have value \"ach\" for \"payment_method_type\"",
"if (jsonData?.payment_method_type) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'giropay'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'ach'\",",
" function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"giropay\");",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"ach\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"display_bank_transfer_information\" for \"next_action.type\"",
+ "if (jsonData?.next_action.type) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'display_bank_transfer_information'\",",
+ " function () {",
+ " pm.expect(jsonData.next_action.type).to.eql(",
+ " \"display_bank_transfer_information\",",
+ " );",
" },",
" );",
"}",
@@ -16935,7 +16098,7 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"giropay\",\"payment_method_data\":{\"bank_redirect\":{\"giropay\":{\"billing_details\":{\"billing_name\":\"John Doe\"},\"bank_name\":\"\",\"preferred_language\":\"en\",\"country\":\"DE\"}}},\"client_secret\":\"{{client_secret}}\"}"
+ "raw": "{\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"ach\",\"payment_method_data\":{\"bank_transfer\":{\"ach_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/confirm",
@@ -17081,7 +16244,7 @@
]
},
{
- "name": "Scenario19-Bank Transfer-ach",
+ "name": "Scenario20-Bank Debit-ach",
"item": [
{
"name": "Payments - Create",
@@ -17152,12 +16315,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" 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 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
@@ -17165,6 +16328,15 @@
],
"type": "text/javascript"
}
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
}
],
"request": {
@@ -17186,7 +16358,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":800,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":800,\"customer_id\":\"poll\",\"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://hs-payments-test.netlify.app/payments\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":1800,\"currency\":\"USD\",\"confirm\":true,\"business_label\":\"default\",\"capture_method\":\"automatic\",\"connector\":[\"stripe\"],\"customer_id\":\"klarna\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"return_url\":\"https://google.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"setup_future_usage\":\"off_session\",\"business_country\":\"US\",\"mandate_data\":{\"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\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"USD\"}}},\"payment_method\":\"bank_debit\",\"payment_method_type\":\"ach\",\"payment_method_data\":{\"bank_debit\":{\"ach_bank_debit\":{\"billing_details\":{\"name\":\"John Doe\",\"email\":\"[email protected]\"},\"account_number\":\"000123456789\",\"routing_number\":\"110000000\"}}},\"metadata\":{\"order_details\":{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":1800,\"account_name\":\"transaction_processing\"}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -17202,29 +16374,26 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(",
- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -17276,61 +16445,12 @@
"// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"next_action.type\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'next_action.type' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.next_action.type !== \"undefined\").to.be.true;",
- " },",
- ");",
- "",
- "// Response body should have value \"ach\" for \"payment_method_type\"",
- "if (jsonData?.payment_method_type) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'ach'\",",
- " function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"ach\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"display_bank_transfer_information\" for \"next_action.type\"",
- "if (jsonData?.next_action.type) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'display_bank_transfer_information'\",",
- " function () {",
- " pm.expect(jsonData.next_action.type).to.eql(",
- " \"display_bank_transfer_information\",",
- " );",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"stripe\" for \"connector\"",
- "if (jsonData?.connector) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
- " function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
- " },",
- " );",
- "}",
- ""
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
""
],
"type": "text/javascript"
@@ -17338,55 +16458,27 @@
}
],
"request": {
- "auth": {
- "type": "apikey",
- "apikey": [
- {
- "key": "value",
- "value": "{{publishable_key}}",
- "type": "string"
- },
- {
- "key": "key",
- "value": "api-key",
- "type": "string"
- },
- {
- "key": "in",
- "value": "header",
- "type": "string"
- }
- ]
- },
- "method": "POST",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"payment_method\":\"bank_transfer\",\"payment_method_type\":\"ach\",\"payment_method_data\":{\"bank_transfer\":{\"ach_bank_transfer\":{\"billing_details\":{\"email\":\"[email protected]\"}}}},\"client_secret\":\"{{client_secret}}\"}"
- },
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id",
- "confirm"
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
],
"variable": [
{
@@ -17396,31 +16488,36 @@
}
]
},
- "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": "Scenario21-Wallet-Wechatpay",
+ "item": [
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Create",
"event": [
{
"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();",
"});",
"",
@@ -17469,12 +16566,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_customer_action\" 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 'requires_customer_action'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
@@ -17485,66 +16582,63 @@
}
],
"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\":800,\"currency\":\"USD\",\"confirm\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":800,\"customer_id\":\"poll\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
},
"response": []
- }
- ]
- },
- {
- "name": "Scenario20-Bank Debit-ach",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments - 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(\"[POST]::/payments - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -17596,28 +16690,86 @@
"// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
- ""
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
+ "",
+ "// Response body should have \"next_action.type\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'next_action.type' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.next_action.type !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have value \"ach\" for \"payment_method_type\"",
+ "if (jsonData?.payment_method_type) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'we_chat_pay'\",",
+ " function () {",
+ " pm.expect(jsonData.payment_method_type).to.eql(\"we_chat_pay\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"qr_code_information\" for \"next_action.type\"",
+ "if (jsonData?.next_action.type) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'qr_code_information'\",",
+ " function () {",
+ " pm.expect(jsonData.next_action.type).to.eql(\"qr_code_information\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"stripe\" for \"connector\"",
+ "if (jsonData?.connector) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
+ " function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
"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": [
{
@@ -17636,18 +16788,27 @@
"language": "json"
}
},
- "raw": "{\"amount\":1800,\"currency\":\"USD\",\"confirm\":true,\"business_label\":\"default\",\"capture_method\":\"automatic\",\"connector\":[\"stripe\"],\"customer_id\":\"klarna\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"return_url\":\"https://google.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"setup_future_usage\":\"off_session\",\"business_country\":\"US\",\"mandate_data\":{\"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\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"USD\"}}},\"payment_method\":\"bank_debit\",\"payment_method_type\":\"ach\",\"payment_method_data\":{\"bank_debit\":{\"ach_bank_debit\":{\"billing_details\":{\"name\":\"John Doe\",\"email\":\"[email protected]\"},\"account_number\":\"000123456789\",\"routing_number\":\"110000000\"}}},\"metadata\":{\"order_details\":{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":1800,\"account_name\":\"transaction_processing\"}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"payment_method\":\"wallet\",\"payment_method_type\":\"we_chat_pay\",\"payment_method_data\":{\"wallet\":{\"we_chat_pay_qr\":{}}},\"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": []
},
@@ -17773,7 +16934,7 @@
]
},
{
- "name": "Scenario21-Wallet-Wechatpay",
+ "name": "Scenario22- Update address and List Payment method",
"item": [
{
"name": "Payments - Create",
@@ -17782,77 +16943,62 @@
"listen": "test",
"script": {
"exec": [
- "// 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\"",
"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 'requires_payment_method'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ "})};",
""
],
"type": "text/javascript"
@@ -17878,7 +17024,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":800,\"currency\":\"USD\",\"confirm\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":800,\"customer_id\":\"poll\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -17894,134 +17040,63 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "List Payment Methods for a Merchant",
"event": [
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// Validate status 2xx ",
+ "pm.test(\"[GET]::/payment_methods/:merchant_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\",",
- " );",
- " },",
- ");",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ "pm.test(\"[GET]::/payment_methods/:merchant_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) {}",
+ "// Parse the response body as JSON",
+ "var responseBody = 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 \"payment_methods\" array contains a \"payment_method\" with the value \"card\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'\", function () {",
+ " var paymentMethods = responseBody.payment_methods;",
+ " var cardPaymentMethod = paymentMethods.find(function (method) {",
+ " return method.payment_method == \"card\";",
+ " });",
+ "});",
"",
- "// 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.\",",
- " );",
- "}",
+ "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"pay_later\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'pay_later'\", function () {",
+ " var paymentMethods = responseBody.payment_methods;",
+ " var cardPaymentMethod = paymentMethods.find(function (method) {",
+ " return method.payment_method == \"pay_later\";",
+ " });",
+ "});",
+ "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"wallet\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'wallet'\", function () {",
+ " var paymentMethods = responseBody.payment_methods;",
+ " var cardPaymentMethod = paymentMethods.find(function (method) {",
+ " return method.payment_method == \"wallet\";",
+ " });",
+ "});",
"",
- "// 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.\",",
- " );",
- "}",
+ "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"bank_debit\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_debit'\", function () {",
+ " var paymentMethods = responseBody.payment_methods;",
+ " var cardPaymentMethod = paymentMethods.find(function (method) {",
+ " return method.payment_method == \"bank_debit\";",
+ " });",
+ "});",
"",
- "// Response body should have value \"requires_customer_action\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_customer_action'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have \"next_action.type\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'next_action.type' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.next_action.type !== \"undefined\").to.be.true;",
- " },",
- ");",
- "",
- "// Response body should have value \"ach\" for \"payment_method_type\"",
- "if (jsonData?.payment_method_type) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'we_chat_pay'\",",
- " function () {",
- " pm.expect(jsonData.payment_method_type).to.eql(\"we_chat_pay\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"qr_code_information\" for \"next_action.type\"",
- "if (jsonData?.next_action.type) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'payment_method_type' matches 'qr_code_information'\",",
- " function () {",
- " pm.expect(jsonData.next_action.type).to.eql(\"qr_code_information\");",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"stripe\" for \"connector\"",
- "if (jsonData?.connector) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
- " function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
- " },",
- " );",
- "}",
- ""
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
+ "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"bank_transfer\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_transfer'\", function () {",
+ " var paymentMethods = responseBody.payment_methods;",
+ " var cardPaymentMethod = paymentMethods.find(function (method) {",
+ " return method.payment_method == \"bank_transfer\";",
+ " });",
+ "});"
],
"type": "text/javascript"
}
@@ -18048,126 +17123,78 @@
}
]
},
- "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\":\"wallet\",\"payment_method_type\":\"we_chat_pay\",\"payment_method_data\":{\"wallet\":{\"we_chat_pay_qr\":{}}},\"client_secret\":\"{{client_secret}}\"}"
- },
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "confirm"
+ "account",
+ "payment_methods"
],
- "variable": [
+ "query": [
{
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
+ "key": "client_secret",
+ "value": "{{client_secret}}"
}
]
},
- "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 filter and list the applicable payment methods for a particular merchant id."
},
"response": []
},
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Update",
"event": [
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/payments/: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]::/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 - 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();",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/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.\",",
- " );",
- "}",
+ "// Parse the JSON response",
+ "var jsonData = pm.response.json();",
"",
- "// 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.\",",
- " );",
- "}",
+ "// Check if the 'currency' is equal to \"EUR\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'currency' matches 'EUR' \", function () {",
+ " pm.expect(jsonData.currency).to.eql(\"EUR\");",
+ "});",
"",
- "// 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.\",",
- " );",
- "}",
+ "// Extract the \"country\" field from the JSON data",
+ "var country = jsonData.billing.address.country;",
"",
- "// Response body should have value \"requires_customer_action\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/payments:id - Content check if value for 'status' matches 'requires_customer_action'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
- " },",
- " );",
- "}",
+ "// Check if the country is \"NL\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if billing 'Country' matches NL (Netherlands)\", function () {",
+ " pm.expect(country).to.equal(\"NL\");",
+ "});",
+ "",
+ "var country1 = jsonData.shipping.address.country;",
+ "",
+ "// Check if the country is \"NL\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if shipping 'Country' matches NL (Netherlands)\", function () {",
+ " pm.expect(country1).to.equal(\"NL\");",
+ "});",
""
],
"type": "text/javascript"
@@ -18175,15 +17202,28 @@
}
],
"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": "{\"currency\":\"EUR\",\"shipping\":{\"address\":{\"line1\":\"1468\",\"line2\":\"Koramangala \",\"line3\":\"Koramangala \",\"city\":\"Bangalore\",\"state\":\"Karnataka\",\"zip\":\"560065\",\"country\":\"NL\",\"first_name\":\"Preeetam\",\"last_name\":\"Rev\"},\"phone\":{\"number\":\"8796455689\",\"country_code\":\"+91\"}},\"billing\":{\"address\":{\"line1\":\"1468\",\"line2\":\"Koramangala \",\"line3\":\"Koramangala \",\"city\":\"Bangalore\",\"state\":\"Karnataka\",\"zip\":\"560065\",\"country\":\"NL\",\"first_name\":\"Preeetam\",\"last_name\":\"Rev\"},\"phone\":{\"number\":\"8796455689\",\"country_code\":\"+91\"}}}"
+ },
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments/:id",
"host": [
"{{baseUrl}}"
],
@@ -18191,188 +17231,59 @@
"payments",
":id"
],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
"variable": [
{
"key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
+ "value": "{{payment_id}}"
}
]
},
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ "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": "Scenario22- Update address and List Payment method",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "List Payment Methods for a Merchant-copy",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx ",
- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ "pm.test(\"[GET]::/payment_methods/:merchant_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]::/payment_methods/:merchant_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.response.to.have.jsonBody();",
- "});",
"",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {jsonData = pm.response.json();}catch(e){}",
+ "// Parse the response body as JSON",
+ "var responseBody = 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 \"payment_methods\" array contains a \"payment_method\" with the value \"card\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'\", function () {",
+ " var paymentMethods = responseBody.payment_methods;",
+ " var cardPaymentMethod = paymentMethods.find(function (method) {",
+ " return method.payment_method == \"card\";",
+ " });",
+ "});",
"",
+ "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"ideal\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id - Content Check if payment_method matches 'ideal'\", function () {",
+ " var paymentMethods = responseBody.payment_methods;",
+ " var cardPaymentMethod = paymentMethods.find(function (method) {",
+ " return method.payment_method == \"ideal\";",
+ " });",
+ "});",
"",
- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
- "if (jsonData?.mandate_id) {",
- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
- " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",
- "} else {",
- " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",
- "};",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
- " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",
- "} else {",
- " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",
- "};",
- "",
- "// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id",
- "if (jsonData?.customer_id) {",
- " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
- " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
- "} else {",
- " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
- "};",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
- "if (jsonData?.status) {",
- "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\", function() {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
- "})};",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
- },
- "response": []
- },
- {
- "name": "List Payment Methods for a Merchant",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx ",
- "pm.test(\"[GET]::/payment_methods/:merchant_id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payment_methods/:merchant_id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
- "});",
- "",
- "// Parse the response body as JSON",
- "var responseBody = pm.response.json();",
- "",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"card\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'\", function () {",
- " var paymentMethods = responseBody.payment_methods;",
- " var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"card\";",
- " });",
- "});",
- "",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"pay_later\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'pay_later'\", function () {",
- " var paymentMethods = responseBody.payment_methods;",
- " var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"pay_later\";",
- " });",
- "});",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"wallet\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'wallet'\", function () {",
- " var paymentMethods = responseBody.payment_methods;",
- " var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"wallet\";",
- " });",
- "});",
- "",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"bank_debit\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_debit'\", function () {",
- " var paymentMethods = responseBody.payment_methods;",
- " var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"bank_debit\";",
- " });",
- "});",
- "",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"bank_transfer\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_transfer'\", function () {",
+ "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"bank_redirect\"",
+ "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_redirect'\", function () {",
" var paymentMethods = responseBody.payment_methods;",
" var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"bank_transfer\";",
+ " return method.payment_method == \"bank_redirect\";",
" });",
"});"
],
@@ -18406,12 +17317,6 @@
{
"key": "Accept",
"value": "application/json"
- },
- {
- "key": "x-feature",
- "value": "router-custom",
- "type": "text",
- "disabled": true
}
],
"url": {
@@ -18435,50 +17340,37 @@
"response": []
},
{
- "name": "Payments - Update",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx ",
- "pm.test(\"[POST]::/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(\"[POST]::/payments/:id - Content-Type is application/json\", function () {",
+ "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 - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
+ "//// Response body should have value \"requires_customer_action\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ "})};",
"",
- "// Parse the JSON response",
- "var jsonData = pm.response.json();",
- "",
- "// Check if the 'currency' is equal to \"EUR\"",
- "pm.test(\"[POST]::/payments/:id -Content Check if 'currency' matches 'EUR' \", function () {",
- " pm.expect(jsonData.currency).to.eql(\"EUR\");",
- "});",
- "",
- "// Extract the \"country\" field from the JSON data",
- "var country = jsonData.billing.address.country;",
- "",
- "// Check if the country is \"NL\"",
- "pm.test(\"[POST]::/payments/:id -Content Check if billing 'Country' matches NL (Netherlands)\", function () {",
- " pm.expect(country).to.equal(\"NL\");",
- "});",
- "",
- "var country1 = jsonData.shipping.address.country;",
- "",
- "// Check if the country is \"NL\"",
- "pm.test(\"[POST]::/payments/:id -Content Check if shipping 'Country' matches NL (Netherlands)\", function () {",
- " pm.expect(country1).to.equal(\"NL\");",
- "});",
""
],
"type": "text/javascript"
@@ -18486,6 +17378,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": [
{
@@ -18504,16 +17416,17 @@
"language": "json"
}
},
- "raw": "{\"currency\":\"EUR\",\"shipping\":{\"address\":{\"line1\":\"1468\",\"line2\":\"Koramangala \",\"line3\":\"Koramangala \",\"city\":\"Bangalore\",\"state\":\"Karnataka\",\"zip\":\"560065\",\"country\":\"NL\",\"first_name\":\"Preeetam\",\"last_name\":\"Rev\"},\"phone\":{\"number\":\"8796455689\",\"country_code\":\"+91\"}},\"billing\":{\"address\":{\"line1\":\"1468\",\"line2\":\"Koramangala \",\"line3\":\"Koramangala \",\"city\":\"Bangalore\",\"state\":\"Karnataka\",\"zip\":\"560065\",\"country\":\"NL\",\"first_name\":\"Preeetam\",\"last_name\":\"Rev\"},\"phone\":{\"number\":\"8796455689\",\"country_code\":\"+91\"}}}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"Example\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"125.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":7000,\"currency\":\"USD\",\"start_date\":\"2023-04-21T00:00:00Z\",\"end_date\":\"2023-05-21T00:00:00Z\",\"metadata\":{\"frequency\":\"13\"}}}},\"setup_future_usage\":\"off_session\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"128.0.0.1\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id"
+ ":id",
+ "confirm"
],
"variable": [
{
@@ -18522,246 +17435,43 @@
}
]
},
- "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": "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": "List Payment Methods for a Merchant-copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx ",
- "pm.test(\"[GET]::/payment_methods/:merchant_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]::/payment_methods/:merchant_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();",
+ "});",
"",
- "// Parse the response body as JSON",
- "var responseBody = pm.response.json();",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
"",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"card\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'card'\", function () {",
- " var paymentMethods = responseBody.payment_methods;",
- " var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"card\";",
- " });",
- "});",
- "",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"ideal\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id - Content Check if payment_method matches 'ideal'\", function () {",
- " var paymentMethods = responseBody.payment_methods;",
- " var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"ideal\";",
- " });",
- "});",
- "",
- "// Check if \"payment_methods\" array contains a \"payment_method\" with the value \"bank_redirect\"",
- "pm.test(\"[GET]::/payment_methods/:merchant_id -Content Check if payment_method matches 'bank_redirect'\", function () {",
- " var paymentMethods = responseBody.payment_methods;",
- " var cardPaymentMethod = paymentMethods.find(function (method) {",
- " return method.payment_method == \"bank_redirect\";",
- " });",
- "});"
- ],
- "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": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- },
- {
- "key": "x-feature",
- "value": "router-custom",
- "type": "text",
- "disabled": true
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/account/payment_methods?client_secret={{client_secret}}",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "account",
- "payment_methods"
- ],
- "query": [
- {
- "key": "client_secret",
- "value": "{{client_secret}}"
- }
- ]
- },
- "description": "To filter and list the applicable payment methods for a particular merchant id."
- },
- "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;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/payments/:id/confirm - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {jsonData = pm.response.json();}catch(e){}",
- "",
- "// Validate if response has JSON Body ",
- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "//// Response body should have value \"requires_customer_action\" for \"status\"",
- "if (jsonData?.status) {",
- "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\", function() {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
- "})};",
- "",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
- "auth": {
- "type": "apikey",
- "apikey": [
- {
- "key": "value",
- "value": "{{publishable_key}}",
- "type": "string"
- },
- {
- "key": "key",
- "value": "api-key",
- "type": "string"
- },
- {
- "key": "in",
- "value": "header",
- "type": "string"
- }
- ]
- },
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"bank_redirect\",\"payment_method_type\":\"ideal\",\"payment_method_data\":{\"bank_redirect\":{\"ideal\":{\"billing_details\":{\"billing_name\":\"Example\",\"email\":\"[email protected]\"},\"bank_name\":\"ing\"}}},\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"125.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"multi_use\":{\"amount\":7000,\"currency\":\"USD\",\"start_date\":\"2023-04-21T00:00:00Z\",\"end_date\":\"2023-05-21T00:00:00Z\",\"metadata\":{\"frequency\":\"13\"}}}},\"setup_future_usage\":\"off_session\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"128.0.0.1\"}}"
- },
- "url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id",
- "confirm"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}"
- }
- ]
- },
- "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
- },
- "response": []
- },
- {
- "name": "Payments - Retrieve",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx ",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
- "});",
- "",
- "// Validate if response has JSON Body ",
- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {jsonData = pm.response.json();}catch(e){}",
- "",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",
- "} else {",
- " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",
- "};",
+ "// pm.collectionVariables - Set 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",
@@ -19092,12 +17802,6 @@
"key": "Accept",
"value": "application/json"
},
- {
- "key": "x-feature",
- "value": "router-custom",
- "type": "text",
- "disabled": true
- },
{
"key": "publishable_key",
"value": "",
@@ -20193,102 +18897,1398 @@
"",
"// 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.');",
- "};",
- "",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",
+ "};",
+ "",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",
+ "};",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",
+ "};",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card 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;",
+ "});",
+ "",
+ "// 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 \"adyen\" for \"connector\"",
+ "if (jsonData?.connector) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
+ " function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " })};"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario26-Save card payment with manual capture",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx ",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",
+ "};",
+ "",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",
+ "};",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",
+ "};",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ "});",
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6000\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount_capturable\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(0);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ },
+ {
+ "name": "List payment methods for a Customer",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx ",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "if (jsonData?.customer_payment_methods[0]?.payment_token) {",
+ " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",
+ " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",
+ "}"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "query": [
+ {
+ "key": "accepted_country",
+ "value": "co",
+ "disabled": true
+ },
+ {
+ "key": "accepted_country",
+ "value": "pa",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "voluptate ea",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "exercitation",
+ "disabled": true
+ },
+ {
+ "key": "minimum_amount",
+ "value": "100",
+ "disabled": true
+ },
+ {
+ "key": "maximum_amount",
+ "value": "10000000",
+ "disabled": true
+ },
+ {
+ "key": "recurring_payment_enabled",
+ "value": "true",
+ "disabled": true
+ },
+ {
+ "key": "installment_payment_enabled",
+ "value": "true",
+ "disabled": true
+ }
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx ",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",
+ "};",
+ "",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",
+ "};",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",
+ "};",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card 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;",
+ "});",
+ "",
+ "// 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 \"requires_capture\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_capture'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "",
+ "// Response body should have value \"stripe\" for \"connector\"",
+ "if (jsonData?.connector) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
+ " function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"7373\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Capture",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ "});",
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6000\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount_capturable\"",
+ "if (jsonData?.amount_capturable) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\":6540,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve-copy",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ "});",
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6000\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(6540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount_capturable\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(0);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Create Copy",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
+ "if (jsonData?.refund_id) {",
+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ " console.log(",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"540\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(540);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ "});",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Retrieve Copy",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
"",
- "// pm.collectionVariables - Set 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 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 {{mandate_id}}, as jsonData.mandate_id is undefined.');",
- "};",
+ " console.log(",
+ " \"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\");",
+ " },",
+ " );",
+ "}",
"",
- "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 \"6540\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(540);",
+ " },",
+ " );",
+ "}",
+ ""
],
"type": "text/javascript"
}
}
],
"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\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
- },
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/refunds/:id",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund 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 Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
},
"response": []
- },
+ }
+ ]
+ },
+ {
+ "name": "Scenario27-Create payment without customer_id and with billing address and shipping address",
+ "item": [
{
- "name": "Save card payments - Confirm",
+ "name": "Payments - Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// 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();",
"});",
"",
@@ -20337,47 +20337,31 @@
" );",
"}",
"",
- "// Response body should have value \"adyen\" for \"connector\"",
- "if (jsonData?.connector) {",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\", function() {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " })};"
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
],
"type": "text/javascript"
}
}
],
"request": {
- "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": [
{
@@ -20396,162 +20380,175 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\"}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "confirm"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
},
"response": []
- }
- ]
- },
- {
- "name": "Scenario26-Save card payment with manual capture",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx ",
- "pm.test(\"[POST]::/payments - 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 - 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 - 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){}",
+ "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.');",
- "};",
- "",
- "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.');",
- "};",
+ " 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'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
- "}"
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
],
"type": "text/javascript"
}
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"adyensavecard_{{random_number}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"371449635398431\",\"card_exp_month\":\"03\",\"card_exp_year\":\"2030\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"7373\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
- },
"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": "Scenario28-Confirm a payment with requires_customer_action status",
+ "item": [
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Create with confirm true",
"event": [
{
"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();",
"});",
"",
@@ -20600,50 +20597,24 @@
" );",
"}",
"",
- "// Response body should have value \"Succeeded\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
- "",
- "// Validate the connector",
- "pm.test(\"[POST]::/payments - connector\", function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
- "});",
- "",
- "// Response body should have value \"6540\" for \"amount\"",
- "if (jsonData?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"6000\" for \"amount_received\"",
- "if (jsonData?.amount_received) {",
- " pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.amount_received).to.eql(6540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount_capturable\"",
- "if (jsonData?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
- " function () {",
- " pm.expect(jsonData.amount_capturable).to.eql(0);",
- " },",
- " );",
- "}",
+ "// Response body should have \"next_action.redirect_to_url\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -20651,201 +20622,250 @@
}
],
"request": {
- "method": "GET",
+ "method": "POST",
"header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
}
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"business_country\":\"US\",\"business_label\":\"default\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"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\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
},
"response": []
},
{
- "name": "List payment methods for a Customer",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx ",
- "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 400\", function () {",
+ " pm.response.to.be.error;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "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) { }",
"",
- "if (jsonData?.customer_payment_methods[0]?.payment_token) {",
- " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",
- " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",
- "} else {",
- " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",
- "}"
+ "",
+ "// Response body should have appropriatae error message",
+ "if (jsonData?.message) {",
+ " pm.test(",
+ " \"Content check if appropriate error message is present\",",
+ " function () {",
+ " pm.expect(jsonData.message).to.eql(\"You cannot confirm this payment because it has status requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ ""
],
"type": "text/javascript"
}
}
],
"request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "customers",
- ":customer_id",
- "payment_methods"
- ],
- "query": [
- {
- "key": "accepted_country",
- "value": "co",
- "disabled": true
- },
- {
- "key": "accepted_country",
- "value": "pa",
- "disabled": true
- },
- {
- "key": "accepted_currency",
- "value": "voluptate ea",
- "disabled": true
- },
- {
- "key": "accepted_currency",
- "value": "exercitation",
- "disabled": true
- },
- {
- "key": "minimum_amount",
- "value": "100",
- "disabled": true
- },
+ "auth": {
+ "type": "apikey",
+ "apikey": [
{
- "key": "maximum_amount",
- "value": "10000000",
- "disabled": true
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
},
{
- "key": "recurring_payment_enabled",
- "value": "true",
- "disabled": true
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
},
{
- "key": "installment_payment_enabled",
- "value": "true",
- "disabled": true
+ "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\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"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",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
],
"variable": [
{
- "key": "customer_id",
- "value": "{{customer_id}}",
- "description": "//Pass the customer id"
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
}
]
},
- "description": "To filter and list the applicable payment methods for a particular Customer ID"
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
},
"response": []
- },
+ }
+ ]
+ },
+ {
+ "name": "Scenario29-Create payment with payment method billing",
+ "item": [
{
- "name": "Save card payments - Create",
+ "name": "Payments - Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
- "// 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.\",",
+ " );",
+ "}",
"",
- "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 \"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\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// 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 \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
],
"type": "text/javascript"
}
@@ -20870,7 +20890,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://google.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -20886,29 +20906,26 @@
"response": []
},
{
- "name": "Save card payments - Confirm",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(",
- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -20916,7 +20933,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) {}",
+ "} catch (e) { }",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -20957,26 +20974,33 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
"",
+ "// 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 \"stripe\" for \"connector\"",
- "if (jsonData?.connector) {",
- " pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'stripe'\",",
- " function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
- " },",
- " );",
- "}",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -20984,55 +21008,27 @@
}
],
"request": {
- "auth": {
- "type": "apikey",
- "apikey": [
- {
- "key": "value",
- "value": "{{publishable_key}}",
- "type": "string"
- },
- {
- "key": "key",
- "value": "api-key",
- "type": "string"
- },
- {
- "key": "in",
- "value": "header",
- "type": "string"
- }
- ]
- },
- "method": "POST",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"7373\"}"
- },
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id",
- "confirm"
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
],
"variable": [
{
@@ -21042,34 +21038,36 @@
}
]
},
- "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": "Scenario30-Update payment with payment method billing",
+ "item": [
{
- "name": "Payments - Capture",
+ "name": "Payments - Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// 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();",
"});",
"",
@@ -21077,7 +21075,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) {}",
+ "} catch (e) { }",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -21092,19 +21090,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);",
@@ -21118,47 +21103,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/:id/capture - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
- "",
- "// Validate the connector",
- "pm.test(\"[POST]::/payments - connector\", function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
- "});",
- "",
- "// Response body should have value \"6540\" for \"amount\"",
- "if (jsonData?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"6000\" for \"amount_received\"",
- "if (jsonData?.amount_received) {",
- " pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
- " function () {",
- " pm.expect(jsonData.amount_received).to.eql(6540);",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"6540\" for \"amount_capturable\"",
- "if (jsonData?.amount_capturable) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.amount_capturable).to.eql(6540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
@@ -21187,51 +21137,42 @@
"language": "json"
}
},
- "raw": "{\"amount_to_capture\":6540,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"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\",\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/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 - Update",
"event": [
{
"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();",
"});",
"",
@@ -21239,91 +21180,26 @@
"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.\",",
- " );",
- "}",
+ "} catch (e) { }",
"",
- "// Response body should have value \"Succeeded\" for \"status\"",
+ "// Response body should have value \"requires_confirmation\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
- "",
- "// Validate the connector",
- "pm.test(\"[POST]::/payments - connector\", function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
- "});",
- "",
- "// Response body should have value \"6540\" for \"amount\"",
- "if (jsonData?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(6540);",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"6000\" for \"amount_received\"",
- "if (jsonData?.amount_received) {",
- " pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6540'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.amount_received).to.eql(6540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
" },",
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount_capturable\"",
- "if (jsonData?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
- " function () {",
- " pm.expect(jsonData.amount_capturable).to.eql(0);",
- " },",
- " );",
- "}",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -21331,15 +21207,28 @@
}
],
"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": "{\"payment_method\":\"card\",\"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\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}}}"
+ },
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments/:id",
"host": [
"{{baseUrl}}"
],
@@ -21347,86 +21236,104 @@
"payments",
":id"
],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
"variable": [
{
"key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
+ "value": "{{payment_id}}"
}
]
},
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ "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 Copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
" );",
"});",
"",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
"// Set response object as internal variable",
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) {}",
+ "} 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.\",",
+ " );",
+ "}",
+ "",
+ "// 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 \"540\" for \"amount\"",
+ "// Response body should have value \"requires_confirmation\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
" },",
" );",
"}",
"",
- "// Validate the connector",
- "pm.test(\"[POST]::/payments - connector\", function () {",
- " pm.expect(jsonData.connector).to.eql(\"stripe\");",
- "});",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -21434,93 +21341,120 @@
}
],
"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": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
- },
"url": {
- "raw": "{{baseUrl}}/refunds",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "description": "To create a refund against an already processed payment"
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
},
"response": []
- },
+ }
+ ]
+ },
+ {
+ "name": "Scenario31-Pass payment method billing in Confirm",
+ "item": [
{
- "name": "Refunds - Retrieve Copy",
+ "name": "Payments - Create",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
" );",
"});",
"",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
"// Set response object as internal variable",
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
"} catch (e) {}",
"",
- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
" console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount\"",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '540'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(540);",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
@@ -21528,63 +21462,75 @@
],
"type": "text/javascript"
}
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "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": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
- }
+ "payments"
]
},
- "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
},
"response": []
- }
- ]
- },
- {
- "name": "Scenario27-Create payment without customer_id and with billing address and shipping address",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments - 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(\"[POST]::/payments - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -21636,21 +21582,21 @@
"// 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/confirm - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"connector_transaction_id\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
""
],
"type": "text/javascript"
@@ -21658,6 +21604,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": [
{
@@ -21676,18 +21642,27 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"card_cvc\":\"123\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
},
"response": []
},
@@ -21719,7 +21694,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) {}",
+ "} catch (e) { }",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -21760,21 +21735,21 @@
" );",
"}",
"",
- "// 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 \"connector_transaction_id\"",
+ "// Response body should have \"payment_method_data.billing\"",
"pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
" function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
" .true;",
" },",
");",