Retrieve a Source
Retrieve information about an existing source including its type, amount, QR code data, and charge status.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`id`STRING(required)
The source ID to retrieve. Must start with src_ followed by test_ or live_ and a unique identifier.
Responsesโ
200
Successful retrievalSource retrieved successfully. Returns the source object with all details.
Response includes:
id- Source identifiertype- Payment method typeflow- Payment flow (offline, redirect, app_redirect)amount- Source amountcurrency- Currency codecharge_status- Status of charge created with source (unknown, pending, successful, failed, expired)scannable_code- QR code data if applicablereferences- Payment references if applicable
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid public key
- Incorrect HTTP Basic Auth format
404
Not foundSource not found. The specified source ID does not exist.
Common causes:
- Invalid source ID format
- Source ID does not exist in your account
- Using test key to access live source (or vice versa)
- Typo in source ID
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/sources/src_test_5xuy4w91xqz7d1w9u0t \
-u pkey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'pkey_test_5xuy4w91xqz7d1w9u0t'
source = Omise::Source.retrieve('src_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_public = 'pkey_test_5xuy4w91xqz7d1w9u0t'
source = omise.Source.retrieve('src_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
publicKey: 'pkey_test_5xuy4w91xqz7d1w9u0t'
});
const source = await omise.sources.retrieve('src_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_PUBLIC_KEY', 'pkey_test_5xuy4w91xqz7d1w9u0t');
$source = OmiseSource::retrieve('src_test_5xuy4w91xqz7d1w9u0t');
Client client = new Client.Builder()
.publicKey("pkey_test_5xuy4w91xqz7d1w9u0t")
.build();
Source source = client.sources().get("src_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("pkey_test_5xuy4w91xqz7d1w9u0t");
var source = await client.Sources.Get("src_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"",
)
source, _ := client.Sources().Get("src_test_5xuy4w91xqz7d1w9u0t")
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
authentication_failure | Invalid API key | Verify your public key is correct |
not_found | Source not found | Check source ID is valid and exists |
Charge Status Valuesโ
| Status | Description |
|---|---|
unknown | No charge created with this source yet |
pending | Payment is pending customer action |
successful | Payment completed successfully |
failed | Payment failed |
expired | Payment expired before completion |
Try it outโ
Required - 1 fields