Skip to main content

Omise Postman Collection

The official Omise Postman collection provides a comprehensive set of pre-configured API requests for testing, development, and automation. With over 100+ endpoints organized by resource type, you can quickly test Omise APIs, debug integration issues, and automate testing workflows.

Overviewโ€‹

What is Postman?โ€‹

Postman is a popular API development platform that simplifies the process of building, testing, and documenting APIs. It provides:

  • Interactive Request Builder - Construct API requests with a user-friendly interface
  • Collection Management - Organize related requests into collections
  • Environment Variables - Manage different configurations (test, production)
  • Automated Testing - Write tests and run them automatically
  • Team Collaboration - Share collections with team members
  • CI/CD Integration - Integrate API tests into deployment pipelines

Why Use the Omise Collection?โ€‹

The Omise Postman collection offers:

  • Pre-configured Requests - 100+ ready-to-use API endpoints
  • Example Responses - Real API response samples for each endpoint
  • Authentication Setup - Automatic API key handling
  • Environment Templates - Test and production configurations
  • Request Validation - Pre-written tests for common scenarios
  • Workflow Examples - Multi-step payment scenarios
  • Documentation - Inline documentation for each request

Installationโ€‹

Prerequisitesโ€‹

  • Postman Account - Free account at postman.com
  • Omise Account - Active account with API keys
  • Postman App - Desktop app or web version

Importing the Collectionโ€‹

Method 1: Direct Import from URLโ€‹

  1. Open Postman

  2. Click Import Button

    Located in the top-left corner of the Postman app

  3. Select "Link" Tab

  4. Enter Collection URL

    https://www.postman.com/omise-api/workspace/omise-public/collection/12345678-abcd-1234-efgh-1234567890ab
  5. Click Continue and Import

Method 2: Import from Fileโ€‹

  1. Download Collection

    Visit the Omise Postman workspace and download the collection JSON file

  2. Import to Postman

    • Click Import button
    • Select "File" tab
    • Choose downloaded JSON file
    • Click Import

Method 3: Fork from Workspaceโ€‹

  1. Visit Omise Public Workspace

    Go to Omise Postman Workspace

  2. Fork Collection

    Click "Fork" button on the collection

  3. Create Fork

    Select your workspace and click "Fork Collection"

Verifying Installationโ€‹

After importing, you should see:

  • Omise API Collection in your Collections sidebar
  • Organized Folders for each resource type (Charges, Customers, etc.)
  • Environment Templates in your Environments section

Setting Up Environment Variablesโ€‹

Environment variables allow you to switch between test and production environments easily.

Creating Test Environmentโ€‹

  1. Click Environments Icon

    Located in the left sidebar

  2. Click "+" to Create New Environment

  3. Name the Environment

    Enter "Omise Test"

  4. Add Variables

    VariableTypeValue
    base_urldefaulthttps://api.omise.co
    secret_keysecretskey_test_your_secret_key
    public_keydefaultpkey_test_your_public_key
    api_versiondefault2019-05-29
  5. Save Environment

Creating Production Environmentโ€‹

Repeat the process for production:

  1. Create New Environment - Name it "Omise Production"

  2. Add Variables with live keys:

    VariableTypeValue
    base_urldefaulthttps://api.omise.co
    secret_keysecretskey_live_your_secret_key
    public_keydefaultpkey_live_your_public_key
    api_versiondefault2019-05-29
  3. Save Environment

Using Environment Variables in Requestsโ€‹

Variables are automatically used in collection requests:

{{base_url}}/charges
Authorization: Basic {{secret_key}}

Selecting Active Environmentโ€‹

Choose the environment from the dropdown in the top-right corner:

  • Select "Omise Test" for development
  • Select "Omise Production" for production testing (use with caution)

Authentication Configurationโ€‹

The Omise Postman collection uses HTTP Basic Authentication with your API keys.

How Authentication Worksโ€‹

Omise uses your secret key as the username with an empty password:

Username: skey_test_your_secret_key
Password: (empty)

Configuring Authenticationโ€‹

Authentication is pre-configured in the collection, but you can customize it:

  1. Open Collection Settings

    Click the "..." menu next to the collection name

  2. Select "Edit"

  3. Go to "Authorization" Tab

  4. Verify Settings

    • Type: Basic Auth
    • Username: {{secret_key}}
    • Password: (empty)
  5. Save Changes

Testing Authenticationโ€‹

Verify authentication is working:

  1. Select "Get Balance" Request

    Found in the "Balance" folder

  2. Send Request

  3. Check Response

    • Status: 200 OK
    • Body contains your account balance

If authentication fails:

  • Verify API key is correct
  • Check environment is selected
  • Ensure no extra spaces in key

Available Endpointsโ€‹

The Omise Postman collection includes all API endpoints organized by resource type.

Chargesโ€‹

Folder: Charges

EndpointMethodDescription
List ChargesGETRetrieve paginated list of charges
Create ChargePOSTCreate a new charge
Get ChargeGETRetrieve specific charge by ID
Update ChargePATCHUpdate charge metadata
Capture ChargePOSTCapture authorized charge
Reverse ChargePOSTReverse uncaptured charge
List Charge SchedulesGETList scheduled charges
Expire ChargePOSTExpire pending charge

Example Variables:

  • {{charge_id}} - Charge ID (e.g., chrg_test_5v7h8gp2xqf0v0k4zy7)

Customersโ€‹

Folder: Customers

EndpointMethodDescription
List CustomersGETGet all customers
Create CustomerPOSTCreate new customer
Get CustomerGETRetrieve customer details
Update CustomerPATCHUpdate customer information
Delete CustomerDELETEDelete customer

Example Variables:

  • {{customer_id}} - Customer ID (e.g., cust_test_5v7h8gp2xqf0v0k4zy7)

Cardsโ€‹

Folder: Cards

EndpointMethodDescription
List CardsGETList customer cards
Get CardGETGet card details
Update CardPATCHUpdate card information
Delete CardDELETERemove card

Example Variables:

  • {{card_id}} - Card ID (e.g., card_test_5v7h8gp2xqf0v0k4zy7)

Tokensโ€‹

Folder: Tokens

EndpointMethodDescription
Create TokenPOSTTokenize card information
Get TokenGETRetrieve token details

Example Variables:

  • {{token_id}} - Token ID (e.g., tokn_test_5v7h8gp2xqf0v0k4zy7)

Refundsโ€‹

Folder: Refunds

EndpointMethodDescription
List RefundsGETList all refunds for a charge
Create RefundPOSTIssue full or partial refund
Get RefundGETGet refund details

Example Variables:

  • {{refund_id}} - Refund ID (e.g., rfnd_test_5v7h8gp2xqf0v0k4zy7)

Transfersโ€‹

Folder: Transfers

EndpointMethodDescription
List TransfersGETList all transfers
Create TransferPOSTCreate manual transfer
Get TransferGETGet transfer details
Update TransferPATCHUpdate transfer information
Destroy TransferDELETECancel scheduled transfer
List Transfer SchedulesGETList scheduled transfers

Example Variables:

  • {{transfer_id}} - Transfer ID (e.g., trsf_test_5v7h8gp2xqf0v0k4zy7)

Recipientsโ€‹

Folder: Recipients

EndpointMethodDescription
List RecipientsGETList all recipients
Create RecipientPOSTCreate new recipient
Get RecipientGETGet recipient details
Update RecipientPATCHUpdate recipient information
Delete RecipientDELETEDelete recipient

Example Variables:

  • {{recipient_id}} - Recipient ID (e.g., recp_test_5v7h8gp2xqf0v0k4zy7)

Disputesโ€‹

Folder: Disputes

EndpointMethodDescription
List DisputesGETList all disputes
Get DisputeGETGet dispute details
Update DisputePATCHUpdate dispute information
List Dispute DocumentsGETList dispute documents
Upload Dispute DocumentPOSTUpload dispute evidence

Example Variables:

  • {{dispute_id}} - Dispute ID (e.g., dspt_test_5v7h8gp2xqf0v0k4zy7)

Sourcesโ€‹

Folder: Sources

EndpointMethodDescription
Create SourcePOSTCreate payment source
Get SourceGETGet source details

Example Variables:

  • {{source_id}} - Source ID (e.g., src_test_5v7h8gp2xqf0v0k4zy7)

Balanceโ€‹

Folder: Balance

EndpointMethodDescription
Get BalanceGETRetrieve account balance

Transactionsโ€‹

Folder: Transactions

EndpointMethodDescription
List TransactionsGETList all transactions
Get TransactionGETGet transaction details

Example Variables:

  • {{transaction_id}} - Transaction ID (e.g., trxn_test_5v7h8gp2xqf0v0k4zy7)

Eventsโ€‹

Folder: Events

EndpointMethodDescription
List EventsGETList all events
Get EventGETGet event details

Example Variables:

  • {{event_id}} - Event ID (e.g., evnt_test_5v7h8gp2xqf0v0k4zy7)

Webhooksโ€‹

Folder: Webhooks

EndpointMethodDescription
List WebhooksGETList webhook endpoints
Create WebhookPOSTCreate webhook endpoint
Get WebhookGETGet webhook details
Update WebhookPATCHUpdate webhook
Delete WebhookDELETEDelete webhook

Example Variables:

  • {{webhook_id}} - Webhook ID (e.g., whev_test_5v7h8gp2xqf0v0k4zy7)

Folder: Payment Links

EndpointMethodDescription
List LinksGETList payment links
Create LinkPOSTCreate payment link
Get LinkGETGet link details

Example Variables:

  • {{link_id}} - Link ID (e.g., link_test_5v7h8gp2xqf0v0k4zy7)

Capabilitiesโ€‹

Folder: Capabilities

EndpointMethodDescription
Get CapabilitiesGETGet account capabilities

Chainsโ€‹

Folder: Charge Schedules

EndpointMethodDescription
List ChainsGETList charge schedules
Get ChainGETGet schedule details

Example Variables:

  • {{chain_id}} - Chain ID (e.g., sch_test_5v7h8gp2xqf0v0k4zy7)

Example Requestsโ€‹

Creating a Chargeโ€‹

Request:

POST {{base_url}}/charges
Authorization: Basic {{secret_key}}
Content-Type: application/json

{
"amount": 100000,
"currency": "THB",
"card": "tokn_test_5v7h8gp2xqf0v0k4zy7",
"description": "Test charge from Postman",
"metadata": {
"order_id": "ORDER-12345",
"customer_name": "John Doe"
}
}

Response:

{
"object": "charge",
"id": "chrg_test_5v7h8gp2xqf0v0k4zy7",
"amount": 100000,
"currency": "THB",
"status": "successful",
"paid": true,
"description": "Test charge from Postman",
"metadata": {
"order_id": "ORDER-12345",
"customer_name": "John Doe"
}
}

Creating a Customerโ€‹

Request:

POST {{base_url}}/customers
Authorization: Basic {{secret_key}}
Content-Type: application/json

{
"email": "customer@example.com",
"description": "VIP Customer",
"card": "tokn_test_5v7h8gp2xqf0v0k4zy7",
"metadata": {
"tier": "premium",
"signup_date": "2026-01-15"
}
}

Response:

{
"object": "customer",
"id": "cust_test_5v7h8gp2xqf0v0k4zy7",
"email": "customer@example.com",
"description": "VIP Customer",
"default_card": "card_test_5v7h8gp2xqf0v0k4zy7",
"metadata": {
"tier": "premium",
"signup_date": "2026-01-15"
}
}

Creating a Refundโ€‹

Request:

POST {{base_url}}/charges/{{charge_id}}/refunds
Authorization: Basic {{secret_key}}
Content-Type: application/json

{
"amount": 50000,
"metadata": {
"reason": "Customer request",
"refund_type": "partial"
}
}

Response:

{
"object": "refund",
"id": "rfnd_test_5v7h8gp2xqf0v0k4zy7",
"amount": 50000,
"currency": "THB",
"charge": "chrg_test_5v7h8gp2xqf0v0k4zy7",
"transaction": "trxn_test_5v7h8gp2xqf0v0k4zy7",
"metadata": {
"reason": "Customer request",
"refund_type": "partial"
}
}

Creating a Tokenโ€‹

Request:

POST {{base_url}}/tokens
Authorization: Basic {{public_key}}
Content-Type: application/json

{
"card": {
"name": "John Doe",
"number": "4242424242424242",
"expiration_month": 12,
"expiration_year": 2027,
"security_code": "123"
}
}

Response:

{
"object": "token",
"id": "tokn_test_5v7h8gp2xqf0v0k4zy7",
"used": false,
"card": {
"object": "card",
"name": "John Doe",
"last_digits": "4242",
"brand": "Visa",
"expiration_month": 12,
"expiration_year": 2027
}
}

Testing Workflowsโ€‹

The Omise Postman collection includes pre-built workflow examples for common payment scenarios.

Workflow 1: Complete Payment Flowโ€‹

This workflow demonstrates creating a charge and verifying the result:

  1. Create Token

    Tokenize card information

  2. Create Charge

    Use token to create charge

  3. Get Charge

    Verify charge was successful

  4. List Transactions

    View transaction history

Running the Workflow:

  1. Open the "Workflows" folder
  2. Select "Complete Payment Flow"
  3. Click "Run" button
  4. View results in Collection Runner

Workflow 2: Customer Managementโ€‹

Create a customer with a card and charge them:

  1. Create Token

    Tokenize card

  2. Create Customer

    Create customer with token

  3. Create Charge with Customer

    Charge the customer

  4. Get Customer

    Verify customer details

Workflow 3: Refund Processโ€‹

Handle refunds properly:

  1. Get Charge

    Retrieve charge to refund

  2. Create Refund

    Issue full or partial refund

  3. Get Refund

    Verify refund status

  4. Get Charge Again

    Verify charge reflects refund

Workflow 4: 3D Secure Paymentโ€‹

Test 3D Secure authentication:

  1. Create Source

    Create 3DS source

  2. Create Charge

    Create charge with source

  3. Get Source

    Get authorization URL

  4. Complete Authentication

    User completes 3DS

  5. Verify Charge

    Confirm charge succeeded

CI/CD Integrationโ€‹

Integrate Omise API tests into your CI/CD pipeline using Newman, Postman's command-line collection runner.

Installing Newmanโ€‹

Install Newman globally:

npm install -g newman

Or add to your project:

npm install --save-dev newman

Exporting Collection and Environmentโ€‹

  1. Export Collection

    • Open collection menu
    • Click "Export"
    • Choose "Collection v2.1"
    • Save as omise-collection.json
  2. Export Environment

    • Open environment menu
    • Click "..." next to environment
    • Select "Export"
    • Save as omise-test-env.json

Running Tests with Newmanโ€‹

Basic command:

newman run omise-collection.json \
--environment omise-test-env.json \
--reporters cli,json

GitHub Actions Integrationโ€‹

Create .github/workflows/api-tests.yml:

name: API Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
api-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Newman
run: npm install -g newman newman-reporter-htmlextra

- name: Create environment file
run: |
cat > omise-test-env.json << EOF
{
"name": "Omise Test",
"values": [
{
"key": "base_url",
"value": "https://api.omise.co",
"enabled": true
},
{
"key": "secret_key",
"value": "${{ secrets.OMISE_SECRET_KEY }}",
"enabled": true
},
{
"key": "public_key",
"value": "${{ secrets.OMISE_PUBLIC_KEY }}",
"enabled": true
}
]
}
EOF

- name: Run API tests
run: |
newman run tests/omise-collection.json \
--environment omise-test-env.json \
--reporters cli,htmlextra \
--reporter-htmlextra-export reports/api-tests.html

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: reports/

GitLab CI Integrationโ€‹

Create .gitlab-ci.yml:

api_tests:
image: node:18
stage: test
before_script:
- npm install -g newman
script:
- |
cat > omise-test-env.json << EOF
{
"name": "Omise Test",
"values": [
{
"key": "base_url",
"value": "https://api.omise.co"
},
{
"key": "secret_key",
"value": "${OMISE_SECRET_KEY}"
},
{
"key": "public_key",
"value": "${OMISE_PUBLIC_KEY}"
}
]
}
EOF
- newman run tests/omise-collection.json \
--environment omise-test-env.json \
--reporters cli,junit \
--reporter-junit-export reports/junit.xml
artifacts:
when: always
reports:
junit: reports/junit.xml

Jenkins Integrationโ€‹

Add to your Jenkinsfile:

pipeline {
agent any

stages {
stage('Setup') {
steps {
sh 'npm install -g newman'
}
}

stage('API Tests') {
steps {
withCredentials([
string(credentialsId: 'omise-secret-key', variable: 'SECRET_KEY'),
string(credentialsId: 'omise-public-key', variable: 'PUBLIC_KEY')
]) {
sh '''
cat > omise-test-env.json << EOF
{
"name": "Omise Test",
"values": [
{"key": "base_url", "value": "https://api.omise.co"},
{"key": "secret_key", "value": "${SECRET_KEY}"},
{"key": "public_key", "value": "${PUBLIC_KEY}"}
]
}