{
  "info": {
    "name": "Cashela Partner Pay-In API v1",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "basic",
    "basic": [
      {
        "key": "username",
        "value": "{{partner_key}}",
        "type": "string"
      },
      {
        "key": "password",
        "value": "{{partner_secret}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://sandbox-api.cashela.com"
    },
    {
      "key": "partner_key",
      "value": ""
    },
    {
      "key": "partner_secret",
      "value": "",
      "type": "secret"
    },
    {
      "key": "idempotency_key",
      "value": "partner-dep-10001"
    },
    {
      "key": "reference",
      "value": "partner-dep-10001"
    }
  ],
  "item": [
    {
      "name": "Get Available Countries",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/v1/pay-in/deposit-creation/countries?countries[]=MEX",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "pay-in",
            "deposit-creation",
            "countries"
          ],
          "query": [
            {
              "key": "countries[]",
              "value": "MEX"
            }
          ]
        }
      }
    },
    {
      "name": "Get Exchange Rates",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/v1/pay-in/deposit-creation/exchange-rates",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "pay-in",
            "deposit-creation",
            "exchange-rates"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"payment_type\": \"VOUCHER\",\n  \"country\": \"MEX\",\n  \"amount\": 100.50\n}"
        }
      }
    },
    {
      "name": "Get Available Payment Methods",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/v1/pay-in/deposit-creation/available-payment-methods",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "pay-in",
            "deposit-creation",
            "available-payment-methods"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"amount\": 100.50,\n  \"country\": \"MEX\",\n  \"fee_on_payer\": false\n}"
        }
      },
      "response": [
        {
          "name": "200 - data_standard published (account with the canonical data standard enabled; fields shown are a subset; mandatory_fields is unchanged)",
          "status": "OK",
          "code": 200,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": true,\n  \"message\": \"Available payment methods retrieved successfully\",\n  \"data\": [\n    {\n      \"payment_type\": \"BANK_TRANSFER\",\n      \"payment_name\": \"Bank transfer\",\n      \"option_payments\": [\n        {\n          \"payment_method\": \"<payment_method to send on Create Deposit>\",\n          \"name\": \"Bank transfer\",\n          \"mandatory_fields\": [\n            {\n              \"fieldName\": \"document_number\"\n            }\n          ],\n          \"data_standard\": {\n            \"schema_version\": \"1.3.0+491a2896d1ee\",\n            \"catalog_version\": \"1.3.0\",\n            \"context\": {\n              \"product\": \"partner_payin_api\",\n              \"direction\": \"in\",\n              \"method\": \"bank_transfer\",\n              \"actor_type\": \"person\",\n              \"country\": \"CL\"\n            },\n            \"fields\": [\n              {\n                \"key\": \"first_name\",\n                \"v1_key\": \"first_name\",\n                \"requirement\": \"required\",\n                \"expected_format\": \"Letters, spaces, hyphens, apostrophes and periods.\",\n                \"error_code\": \"invalid_person_name\"\n              },\n              {\n                \"key\": \"document_number\",\n                \"v1_key\": \"document_number\",\n                \"requirement\": \"required\",\n                \"expected_format\": \"The document number of the selected type, as issued.\",\n                \"error_code\": \"invalid_document\"\n              },\n              {\n                \"key\": \"phone_number\",\n                \"v1_key\": \"phone\",\n                \"requirement\": \"required\",\n                \"expected_format\": \"International format: + country code and number, e.g. +18092345678.\",\n                \"error_code\": \"invalid_phone\"\n              }\n            ]\n          }\n        }\n      ]\n    }\n  ]\n}"
        }
      ]
    },
    {
      "name": "Create Deposit",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Idempotency-Key",
            "value": "{{idempotency_key}}"
          },
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/v1/pay-in/deposit-creation",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "pay-in",
            "deposit-creation"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"payment_type\": \"VOUCHER\",\n  \"payment_method\": \"<payment_method from Get Available Payment Methods>\",\n  \"amount\": 100.50,\n  \"country\": \"MEX\",\n  \"external_identifier\": \"{{reference}}\",\n  \"invoice_description\": \"Order 10001\",\n  \"notification_url\": \"https://partner.example/webhooks/cashela\",\n  \"redirect_url\": \"https://partner.example/return\",\n  \"logo\": \"https://partner.example/logo.png\",\n  \"mobile\": false,\n  \"language\": \"es\",\n  \"fee_on_payer\": false,\n  \"client_ip\": \"189.203.0.10\",\n  \"first_name\": \"Juan\",\n  \"last_name\": \"Perez\",\n  \"email\": \"juan.perez@example.com\"\n}"
        }
      },
      "response": [
        {
          "name": "422 - field_errors (account with the canonical data standard enabled): one entry per field, never the submitted value; nothing quoted, persisted or sent to the provider",
          "status": "Unprocessable Entity",
          "code": 422,
          "_postman_previewlanguage": "json",
          "header": [
            {
              "key": "Content-Type",
              "value": "application/json"
            }
          ],
          "body": "{\n  \"success\": false,\n  \"status\": false,\n  \"errors\": {\n    \"first_name\": [\n      \"The first_name is invalid. Expected: Letters, spaces, hyphens, apostrophes and periods.\"\n    ]\n  },\n  \"message\": \"HTTP ENTITY NOT PROCESSABLE\",\n  \"field_errors\": [\n    {\n      \"field\": \"first_name\",\n      \"code\": \"invalid_person_name\",\n      \"expected_format\": \"Letters, spaces, hyphens, apostrophes and periods.\",\n      \"schema_version\": \"1.3.0+491a2896d1ee\",\n      \"trace_id\": \"<trace id of the request>\"\n    }\n  ]\n}"
        }
      ]
    },
    {
      "name": "Get Transaction",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/v1/pay-in/transactions/{{reference}}",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "pay-in",
            "transactions",
            "{{reference}}"
          ]
        }
      }
    },
    {
      "name": "Resend Callback",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/v1/pay-in/transactions/{{reference}}/callback",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "pay-in",
            "transactions",
            "{{reference}}",
            "callback"
          ]
        }
      }
    },
    {
      "name": "Sandbox: Simulate Final Status",
      "request": {
        "description": "SANDBOX ONLY. 404 on production. status = COMPLETED, DECLINED or CANCELLED; fires the real signed callback.",
        "method": "POST",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": {
          "raw": "{{base_url}}/api/v1/pay-in/sandbox/transactions/{{reference}}/simulate",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "api",
            "v1",
            "pay-in",
            "sandbox",
            "transactions",
            "{{reference}}",
            "simulate"
          ]
        },
        "body": {
          "mode": "raw",
          "raw": "{\n  \"status\": \"COMPLETED\"\n}"
        }
      }
    }
  ]
}
