Postman Collection Guide
The ProBuy Postman Collection provides a comprehensive set of pre-configured API requests to help you test and develop your integration quickly. Import the collection and start testing all ProBuy API endpoints immediately.
Collection Contents
- • All ProBuy API endpoints with examples
- • Pre-configured environments (sandbox and production)
- • Automated test scripts for validation
- • Sample requests and responses
- • Environment variables for easy configuration
- • Authentication setup included
Download and Import
Step 1: Download Postman
If you haven't already, download and install Postman:
Download Postman
Postman is available for Windows, macOS, and Linux. The collection works with Postman v10.0+
Download PostmanStep 1.5: Download ProBuy Collection Files
Download the ProBuy Postman collection and environment files:
API Collection
Complete collection with all endpoints
Sandbox Environment
Development/testing environment
Production Environment
Live production environment
Step 2: Import Collection
Import the ProBuy collection into Postman:
- 1. Open Postman
- 2. Click the "Import" button in the top-left
- 3. Drag and drop the downloaded
probuy-api-collection.jsonfile - 4. Click "Import"
- 5. The collection will appear in your workspace
Step 3: Import Environments
Import environment files for sandbox and production:
- 1. Click "Import" in Postman again
- 2. Import
probuy-sandbox-environment.jsonfor testing - 3. Import
probuy-production-environment.jsonfor live use - 4. Both environments will appear in the environment dropdown (top-right)
Start with Sandbox
Always start with the Sandbox environment for testing. Only switch to Production after completing all testing and receiving approval.
Environment Configuration
Configure Sandbox Environment
Set up your sandbox environment for testing:
1. Click the environment dropdown (top-right)2. Select "ProBuy Sandbox (Development)"3. Click the eye icon to view/edit variables4. Update these variables:
Variable Name | Value to Update--------------------- | ---------------------------------api_token | YOUR_SANDBOX_API_TOKEN (get from supplier portal)merchant_success_url | https://yourstore.com/payment/successmerchant_failure_url | https://yourstore.com/payment/failuremerchant_cancel_url | https://yourstore.com/payment/cancelwebhook_url | https://webhook.site/YOUR_UNIQUE_URL (for testing)
Pre-configured values (no changes needed):- base_url: https://sandboxapi.probuy.dev- supplier_portal: https://sandboxsupplier.probuy.devGetting Your API Token
To get your sandbox API token:
- 1. Log in to Sandbox Supplier Portal
- 2. Navigate to Integrations → API Tokens
- 3. Click "Create New Token"
- 4. Copy the token immediately (shown only once)
Configure Production Environment
Production Warning
Only use production environment after completing testing and receiving approval from ProBuy. Production requests process real payments and cannot be undone.
Variable Name | Value to Update--------------------- | ---------------------------------api_token | YOUR_PRODUCTION_API_TOKEN (get from supplier portal)merchant_success_url | https://yourstore.com/payment/successmerchant_failure_url | https://yourstore.com/payment/failuremerchant_cancel_url | https://yourstore.com/payment/cancelwebhook_url | https://yourserver.com/webhooks/probuy
Pre-configured values (no changes needed):- base_url: https://api.probuy.me- supplier_portal: https://supplier.probuy.me- company_portal: https://company.probuy.meCollection Structure
The collection is organized into logical folders:
📁 1. Authentication
- • Get API Token
- • Refresh Token
- • Validate Token
📁 2. Checkout Management
- • Create Checkout Session
- • Get Checkout Details
- • Update Checkout
- • Cancel Checkout
- • List Checkouts
📁 3. Order Management
- • Get Order Details
- • List Orders
- • Update Order Status
- • Add Order Note
📁 4. Payments & Refunds
- • Capture Payment
- • Refund Payment (Full)
- • Refund Payment (Partial)
- • Get Refund Details
- • List Refunds
📁 5. Customer Management
- • Get Customer Details
- • Check Eligibility
- • Get Customer Orders
- • Get Installment Schedule
📁 6. Webhooks
- • Register Webhook
- • List Webhooks
- • Test Webhook
- • Delete Webhook
- • Webhook Verification Example
📁 7. Analytics & Reporting
- • Get Transaction Summary
- • Get Revenue Report
- • Export Transactions
- • Get Settlement Details
Common API Requests
1. Create Checkout Session
The most common request - creating a new checkout session:
POST {{base_url}}/checkoutAuthorization: Bearer {{api_token}}Content-Type: application/json
{ "orderReferenceId": "ORD-{{$timestamp}}", "orderNumber": "ORDER-12345", "currency": "SAR", "totalAmount": 1500.00, "taxAmount": 225.00, "consumer": { "firstName": "Ahmed", "lastName": "Al-Saud", "phoneNumber": "+966501234567" }, "billingAddress": { "line1": "123 King Fahd Road", "city": "Riyadh", "state": "Riyadh Province", "postalCode": "12345", "countryCode": "SA" }, "items": [ { "name": "Test Product", "sku": "TEST-001", "quantity": 1, "unitPrice": 1500.00, "totalAmount": 1500.00 } ], "countryCode": "SA", "merchantUrls": { "successUrl": "{{merchant_success_url}}", "failureUrl": "{{merchant_failure_url}}", "cancelUrl": "{{merchant_cancel_url}}", "webhookUrl": "{{webhook_url}}" }}
Tests (Pre-written in collection):pm.test("Status code is 201", function () { pm.response.to.have.status(201);});
pm.test("Response has checkoutId", function () { var jsonData = pm.response.json(); pm.expect(jsonData.checkoutId).to.exist; pm.environment.set("checkout_id", jsonData.checkoutId);});2. Get Checkout Details
GET {{base_url}}/checkout/{{checkout_id}}Authorization: Bearer {{api_token}}
Tests:pm.test("Status code is 200", function () { pm.response.to.have.status(200);});
pm.test("Checkout has valid status", function () { var jsonData = pm.response.json(); pm.expect(jsonData.status).to.be.oneOf([ "pending", "approved", "declined", "cancelled", "expired" ]);});3. Check Customer Eligibility
POST {{base_url}}/eligibility/checkAuthorization: Bearer {{api_token}}Content-Type: application/json
{ "consumer": { "phoneNumber": "+966501234567" }, "amount": 1500.00, "currency": "SAR", "countryCode": "SA"}
Tests:pm.test("Eligibility check returns eligible status", function () { var jsonData = pm.response.json(); pm.expect(jsonData.eligible).to.be.a('boolean'); pm.expect(jsonData.maxAmount).to.be.a('number');});4. Process Refund
POST {{base_url}}/checkout/{{checkout_id}}/refundAuthorization: Bearer {{api_token}}Content-Type: application/json
{ "amount": 500.00, "reason": "Customer requested partial refund", "refundType": "partial"}
Tests:pm.test("Refund created successfully", function () { pm.response.to.have.status(201); var jsonData = pm.response.json(); pm.expect(jsonData.refundId).to.exist; pm.environment.set("refund_id", jsonData.refundId);});Running Tests
Run Individual Request
- 1. Select a request from the collection
- 2. Review the request body and parameters
- 3. Click "Send"
- 4. View response in the lower panel
- 5. Check "Test Results" tab for validation
Run Entire Collection
Use Collection Runner to execute all requests sequentially:
1. Click "..." next to collection name2. Select "Run collection"3. Configure runner: - Select environment (ProBuy Sandbox) - Choose iterations: 1 - Delay: 1000ms between requests4. Click "Run ProBuy API Collection"5. View test results and pass/fail statusAutomated Testing with Newman
Run the collection from command line using Newman:
# Install Newmannpm install -g newman
# Run collectionnewman run probuy-collection.json \ -e probuy-sandbox-environment.json \ --reporters cli,html \ --reporter-html-export ./test-results.html
# Run with specific foldernewman run probuy-collection.json \ -e probuy-sandbox-environment.json \ --folder "Checkout Management"
# Run in CI/CD pipelinenewman run probuy-collection.json \ -e probuy-sandbox-environment.json \ --bail \ --reporters cli,junit \ --reporter-junit-export ./junit-results.xmlPre-Request Scripts
The collection includes helpful pre-request scripts:
// Generate unique order referencepm.environment.set("order_reference_id", "ORD-" + Date.now());
// Generate random customer emailpm.environment.set("test_email", "test-" + Date.now() + "@test.probuy.dev");
// Set current timestamppm.environment.set("timestamp", new Date().toISOString());
// Calculate tax (15%)const subtotal = pm.variables.get("subtotal");const taxAmount = subtotal * 0.15;pm.environment.set("tax_amount", taxAmount);pm.environment.set("total_amount", subtotal + taxAmount);Environment Variables Reference
| Variable | Description | Example |
|---|---|---|
base_url | API base URL | https://sandbox-api.probuy.dev/v1 |
api_token | Your API authentication token | sk_test_abc123... |
checkout_id | Auto-set from create checkout response | chk_abc123def456 |
order_id | Auto-set from order responses | ord_xyz789 |
refund_id | Auto-set from refund responses | ref_123abc |
base_urlhttps://sandbox-api.probuy.dev/v1api_tokensk_test_abc123...checkout_idchk_abc123def456order_idord_xyz789refund_idref_123abcWebhook Testing
Test webhook integration using Postman Mock Server or webhook.site:
Using webhook.site
- 1. Visit webhook.site
- 2. Copy your unique URL
- 3. Set it in Postman:
webhook_urlvariable - 4. Create a checkout with this webhook URL
- 5. Complete checkout flow
- 6. View webhook payload on webhook.site
Webhook Verification Script
// Webhook signature verification (add to test script)const crypto = require('crypto');
pm.test("Webhook signature is valid", function () { const signature = pm.request.headers.get('X-ProBuy-Signature'); const body = pm.request.body.raw; const secret = pm.environment.get('webhook_secret');
const expectedSignature = 'sha256=' + crypto.createHmac('sha256', secret) .update(body) .digest('hex');
pm.expect(signature).to.equal(expectedSignature);});Troubleshooting
401 Unauthorized Error
Solutions:
- • Verify
api_tokenis set correctly in environment - • Check token hasn't expired
- • Ensure using correct environment (sandbox vs production)
- • Token should start with
sk_test_(sandbox) orsk_live_(production)
Variables not resolved
Check:
- • Environment is selected (top-right dropdown)
- • Variable names match exactly (case-sensitive)
- • Variables exist in current environment
- • Check variable scope (environment vs collection vs global)
Test failures
Debug steps:
- • Check "Test Results" tab for specific failures
- • Review response body for error messages
- • Verify request body matches expected format
- • Check Postman Console (View > Show Postman Console)
Best Practices
Use Sandbox First
Always test with sandbox environment before switching to production. Sandbox uses test data and doesn't process real payments.
Save Your Work
Save modified requests in your own workspace. Fork the collection to keep it separate from future updates.
Use Collection Variables
Store frequently used values as variables. This makes requests easier to maintain and update.
Review Responses
Always review full response bodies. They contain valuable debugging information and show actual data structures.
Document Custom Requests
Add descriptions to custom requests. Future you (and your team) will thank you.
Support
Collection Support
Issues with the Postman collection
Email: [email protected]
GitHub: Report Issues
Response: Within 4 hours