Swipe PaySwipe Pay
DocsAPI ReferenceIntroduction
API Reference

Swipe Payments API

The Swipe API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Quickstart

Accept your first payment in under 10 minutes.

SDKs

Official libraries for Node, PHP, Python & Go.

Base URL

All API requests are made to the following base URL. The API is served exclusively over HTTPS — requests made over plain HTTP will fail.

BASEhttps://api.swipe.inc/v1

Authentication

The Swipe API uses API keys to authenticate requests. You can view and manage your keys in the Swipe Dashboard. Test-mode keys have the prefix sk_test_ and live-mode keys have the prefix sk_live_.

Authentication is performed via HTTP Bearer auth. Provide your secret key as the bearer token value. All API requests must be made over HTTPS.

Keep your keys secret. Your secret key can create charges and issue refunds. Never expose it in client-side code, commit it to version control, or share it in support tickets.
curl https://api.swipe.inc/v1/payments \
  -H "Authorization: Bearer sk_test_51H8xQ2eZvKYlo2C" \
  -H "Content-Type: application/json"

Making requests

The API accepts request bodies as JSON or form-encoded data. For requests that create or update resources, pass an Idempotency-Key header to safely retry without accidentally performing the same operation twice.

  • Timestamps are returned in Unix epoch seconds unless otherwise noted.
  • All amounts are represented in the smallest currency unit (e.g. cents, sen).
  • Pagination is cursor-based via the starting_after and limit parameters.

Errors

Swipe uses conventional HTTP response codes to indicate the success or failure of a request. Codes in the 2xx range indicate success, 4xx codes indicate a client error, and 5xx codes indicate a server error.

CodeMeaning
200 OKEverything worked as expected.
400 Bad RequestThe request was unacceptable, often due to a missing parameter.
401 UnauthorizedNo valid API key was provided.
402 Request FailedThe parameters were valid but the request failed.
500 Server ErrorSomething went wrong on Swipe's end.

Rate limits

The API allows up to 100 requests per second in live mode and 25 requests per second in test mode. If you exceed the limit, requests return a 429 Too Many Requests response. Every response includes X-RateLimit-Remaining and X-RateLimit-Reset headers.

The Payment object

Represents a single payment intent — the full lifecycle of collecting money from a customer. Below are the attributes returned on every payment resource.

idstring

Unique identifier for the object, prefixed with pay_.

amountinteger

Amount intended to be collected, in the smallest currency unit.

currencystring

Three-letter ISO currency code, in lowercase.

statusenum

One of pending, succeeded, failed, or refunded.

metadataobject

Set of key-value pairs you can attach to the object.

The Payment object
{
  "id": "pay_3MtwBwLkdIwHu7ix",
  "object": "payment",
  "amount": 2500,
  "currency": "idr",
  "status": "succeeded",
  "created": 1719763200,
  "metadata": {
    "order_id": "6735"
  }
}

Create a payment

POST/v1/payments

Creates a new payment. Once created, you can confirm it to attempt to move money from the customer's payment method to your Swipe balance.

Parameters

amount
integerrequired

A positive integer representing how much to charge, in the smallest currency unit.

currency
stringrequired

Three-letter ISO currency code, in lowercase. Must be a supported currency.

payment_method
stringoptional

ID of the payment method to charge. Defaults to the customer's default method.

metadata
objectoptional

Set of key-value pairs for storing additional structured information.

Request
curl https://api.swipe.inc/v1/payments \
  -u sk_test_51H8xQ2: \
  -d amount=2500 \
  -d currency=idr \
  -d payment_method=pm_card_visa
Response 200
{
  "id": "pay_3MtwBwLkdIwHu7ix",
  "amount": 2500,
  "currency": "idr",
  "status": "succeeded"
}

Retrieve a payment

GET/v1/payments/:id

Retrieves the details of a payment that has previously been created. Supply the unique payment ID returned from your create request.

Request
curl https://api.swipe.inc/v1/payments/pay_3MtwBwLkdIwHu7ix \
  -u sk_test_51H8xQ2:

List payments

GET/v1/payments

Returns a list of payments you've previously created. The payments are returned in sorted order, with the most recent appearing first. Use the limit and starting_after parameters to paginate.

Refund a payment

POST/v1/payments/:id/refund

Refunds a payment that has previously been created but not yet refunded. Funds are refunded to the original payment method. You can refund the full amount or issue a partial refund by specifying an amount.

Webhooks

Webhooks let your application receive real-time notifications when events happen in your account — such as a payment succeeding or a refund completing. Configure endpoint URLs in your Dashboard and verify each event with the signature in the Swipe-Signature header.

SDKs & libraries

Official client libraries wrap the Swipe API so you can integrate quickly in your language of choice.

Swipe PaySwipe Pay

Every transaction, elevated. The payment platform for Indonesian business.

Products
Swipe GOSwipe POSSwipe OnlineDevices
Solutions
RetailF&BE-commerceAll solutions
Support
Contact SupportDocumentationAPI DocumentationStatus
Why Us
About UsLegalPartnersProject Pipeline
© 2026 Swipe. Inc · Licensed by Bank Indonesia (PJP) · PCI-DSS Level 1every transaction, elevated