Skip to main content

Basic API Structure Overview

For production-ready sample code, refer to the official SDKs:

Making API Requests with Your Secret Key

Assets APIs

1. List Assets

For detailed API reference, see: List Assets API

FieldValue
API NameList Assets
API Endpoint/v1/assets/list
HTTP MethodGET
Data FormatQuery Parameters
AuthenticationNone

Request URL: GET https://api.martianpay.com/v1/assets

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Example Request:

curl --location --request GET 'https://api.martianpay.com/v1/assets' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response will be a JSON object containing the list of assets for the specified merchant.

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"assets": [
{
"id": "USDC-Solana-TEST",
"display_name": "USD Coin(Solana Devnet)",
"coin": "USDC",
"is_fiat": false,
"decimals": 6,
"payable": true,
"network": "Solana Devnet",
"is_mainnet": false,
"contract_address": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",
"address_url_template": "https://explorer.solana.com/address/%s?cluster=devnet",
"tx_url_template": "https://explorer.solana.com/tx/%s?cluster=devnet",
"token": "USDC",
"chain_id": 0
},
......
{
"id": "USDC-Ethereum-TEST",
"display_name": "USDC",
"coin": "USDC",
"is_fiat": false,
"decimals": 6,
"payable": true,
"network": "Ethereum Sepolia",
"is_mainnet": false,
"contract_address": "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
"address_url_template": "https://sepolia.etherscan.io/address/%s",
"tx_url_template": "https://sepolia.etherscan.io/tx/%s",
"token": "USDC",
"chain_id": 11155111
},
{
"id": "USD",
"display_name": "US Dollar",
"coin": "USD",
"is_fiat": true,
"decimals": 2,
"payable": false,
"symbol": "$"
}
]
}
}

Response Parameter Description:

ParameterDescription
idUnique identifier for the asset (USDC on Ethereum testnet)
display_nameHuman-readable name of the asset
coinCryptocurrency code
is_fiatIndicates if the asset is a fiat currency (false for crypto)
decimalsNumber of decimal places for the asset
payableWhether the asset can be used for payments
networkThe blockchain network (Ethereum Sepolia testnet)
is_mainnetIndicates if it's on the main network (false for testnet)
contract_addressThe smart contract address for the token
address_url_templateURL template for viewing addresses on block explorer
tx_url_templateURL template for viewing transactions on block explorer
tokenToken symbol
chain_idEthereum network identifier (11155111 for Sepolia)

2. List All Assets

For detailed API reference, see: List All Assets API

FieldValue
API NameList All Assets
API Endpoint/v1/assets/all
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/assets/all

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Example:

curl --location --request GET 'https://api.martianpay.com/v1/assets/all' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

3. Get Asset Fees

For detailed API reference, see: Get Asset Fees API

FieldValue
API NameGet Asset Fees
API Endpoint/v1/assets/fees
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/assets/fees

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Example:

curl --location --request GET 'https://api.martianpay.com/v1/assets/fees' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

Customer APIs

4. Create Customer

For detailed API reference, see: Create Customer API

Request Method: POST

Request Path: https://api.martianpay.com/v1/customers

Request Parameters (JSON body):

ParameterTypeRequiredDescriptionExample
namestringNoCustomer's nameJohn Doe
emailstringNoCustomer's email addressjohn@example.com
descriptionstringNoAdditional customer informationVIP customer
metadataobjectNoCustom key-value pairs

Request Example (cURL)

curl --location --request POST 'https://api.martianpay.com/v1/customers' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"name": "John Doe",
"email": "john@example.com",
"description": "VIP customer",
"metadata": {
"order_id": "12345"
}
}'

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "cus_123456",
"object": "customer",
"name": "John Doe",
"email": "john@example.com",
"description": "VIP customer",
"metadata": {
"order_id": "12345"
},
"created": 1631234567
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the customer
objectstringObject type, always "customer"
namestringCustomer's name
emailstringCustomer's email address
descriptionstringAdditional customer information
metadataobjectCustom key-value pairs
createdint64Timestamp of customer creation (Unix time)

5. List Customers

For detailed API reference, see: List Customers API

Request Method: GET

Request Path: https://api.martianpay.com/v1/customers

Request Parameters (Query String):

ParameterTypeRequiredDescriptionExample
pageint32YesPage number, starting from 00
page_sizeint32YesNumber of records per page, at least 110
emailstringNoFilter customers by emailuser@example.com

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"customers": [ Array of Customer objects ],
"total": Total record count,
"page": Current page number,
"page_size": Number of records per page
}
}

✅ Request Example (cURL)

curl --location --request GET 'https://api.martianpay.com/v1/customers?page=0&page_size=10&email=user@example.com' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

📌 Response Example (JSON)

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"customers": [ ... ],
"total": 1,
"page": 0,
"page_size": 10
}
}

Response Parameter Description:

Top-level Response Structure (CustomerListResp)

ParameterTypeDescription
customersCustomer[]Customer list
totalint32Total number of customers matching the query
pageint32Current page number (starting from 0)
page_sizeint32Number of customer records per page

6. Retrieve a Single Customer

For detailed API reference, see: Get Customer API

Request Method: GET

Request Path: https://api.martianpay.com/v1/customers/{id}

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesUnique customer IDcus_12345

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "cus_12345",
"object": "customer",
"total_expense": 500,
"total_payment": 550,
"total_refund": 50,
"currency": "USD",
"created": 1740731398,
"name": "John Doe",
"email": "user@example.com",
"description": "Test customer",
"metadata": {
"source": "api",
"vip": "yes"
},
"phone": "+1234567890"
}
}

✅ Request Example (cURL)

curl --location --request GET 'https://api.martianpay.com/v1/customers/cus_12345' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

📌 Response Example (JSON)

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "cus_12345",
"object": "customer",
"total_expense": 500,
"total_payment": 550,
"total_refund": 50,
"currency": "USD",
"created": 1740731398,
"name": "John Doe",
"email": "user@example.com",
"description": "Test customer",
"metadata": {
"source": "api",
"vip": "yes"
},
"phone": "+1234567890"
}
}

7. Update Customer

For detailed API reference, see: Update Customer API

Request Method: POST

Request Path: https://api.martianpay.com/v1/customers/cus_7p51tXM7GBi7sz5J

Request Parameters (JSON body):

ParameterTypeRequiredDescriptionExample
namestringNoCustomer's new nameJane Doe
emailstringNoCustomer's new email addressjane@example.com
descriptionstringNoUpdated customer informationPlatinum customer
metadataobjectNoUpdated custom key-value pairs

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "cus_7p51tXM7GBi7sz5J",
"object": "customer",
"name": "Jane Doe",
"email": "jane@example.com",
"description": "Platinum customer",
"metadata": {
"status": "active"
},
"updated": 1631234567
}
}

Request Example (cURL)

curl --location --request POST 'https://api.martianpay.com/v1/customers/cus_7p51tXM7GBi7sz5J' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"name": "Jane Doe",
"email": "jane@example.com",
"description": "Platinum customer",
"metadata": {
"status": "active"
}
}'

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "cus_123456",
"object": "customer",
"name": "John Doe",
"email": "john@example.com",
"description": "VIP customer",
"metadata": {
"order_id": "12345"
},
"created": 1631234567
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the customer
objectstringObject type, always "customer"
namestringCustomer's name
emailstringCustomer's email address
descriptionstringAdditional customer information
metadataobjectCustom key-value pairs
createdint64Timestamp of customer creation (Unix time)

8. Delete Customer

For detailed API reference, see: Delete Customer API

FieldValue
API NameDelete Customer
API Endpoint/v1/customers/{id}
HTTP MethodDELETE
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: DELETE https://api.martianpay.com/v1/customers/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesUnique customer identifier to delete

Example:

curl --location --request DELETE 'https://api.martianpay.com/v1/customers/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

9. Create Ephemeral Token for Customer

For detailed API reference, see: Create Ephemeral Token API

FieldValue
API NameCreate Ephemeral Token for Customer
API Endpoint/v1/customers/ephemeral_tokens
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/customers/ephemeral_tokens

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Body:

{
"idp_key": "email",
"idp_subject": "user@example.com",
"provider": "instagram",
"allow_create": true,
"issued_by": "instagram_commerce_bot",
"channel_metadata": {
"instagram_user_id": "12345",
"dm_thread_id": "67890"
}
}

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
idp_keystringNoIdentity provider type - determines how to identify the customer. Valid values: "email", "phone", "uuid". Optional: If not provided, creates an anonymous ephemeral token (only order_id based)email
idp_subjectstringNoUnique identifier under the specified IDP. When idp_key="email", this should be the email address. When idp_key="phone", this should be the phone number. When idp_key="uuid", this should be a UUID. Optional: If not provided along with idp_key, creates an anonymous ephemeral tokenuser@example.com
providerstringNoChannel or platform initiating the request. Examples: "instagram", "whatsapp", "wechat", "telegram". Used for tracking and channel-specific business logic. Optional: If not provided, creates an anonymous ephemeral tokeninstagram
order_idstringNoOrder identifier to associate with this ephemeral token. When provided, this order_id will be returned when the token is resolved. Useful for tracking which order the customer authentication is forord_abc123
return_urlstringNoURL to redirect the customer after authentication/payment. Used in social media integrations where the flow needs to return to a specific page. This URL will be returned when the ephemeral token is resolvedhttps://example.com/payment/success
allow_createbooleanNoDetermines whether to create a new customer if not found (default: true). Set to false to return an error if customer doesn't existtrue
issued_bystringNoIdentifies the system or service issuing this token request. Used for audit logging and tracking token origininstagram_commerce_bot
channel_metadataobjectNoStores arbitrary channel-specific data. Examples: {"instagram_user_id": "12345", "dm_thread_id": "67890"}{"instagram_user_id": "12345"}

Example:

curl --location --request POST 'https://api.martianpay.com/v1/customers/ephemeral_tokens' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"idp_key": "email",
"idp_subject": "user@example.com",
"provider": "instagram",
"order_id": "ord_abc123",
"allow_create": true,
"issued_by": "instagram_commerce_bot",
"channel_metadata": {
"instagram_user_id": "12345",
"dm_thread_id": "67890"
}
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"token": "eph_abc123xyz789",
"expires_at": 1735689600
}
}

Response Parameter Description:

ParameterTypeDescription
tokenstringEphemeral token string (short-lived, typically 5-15 minutes). Use this token with payment link URLs
expires_atintegerUnix timestamp when the ephemeral token expires

Important Note:

The ephemeral token is used to authenticate customers when accessing payment links. Include the token as a query parameter in the payment link URL:

https://buy.martianpay.com/{payment_link_id}?ephemeral_token={token}

Example:

https://buy.martianpay.com/plink_abc123?ephemeral_token=eph_abc123xyz789

This allows customers to access pre-authenticated payment experiences through various channels (Instagram, WhatsApp, etc.) without requiring them to log in separately.

10. Resolve Customer Identity

For detailed API reference, see: Resolve Customer Identity API

FieldValue
API NameResolve Customer Identity
API Endpoint/v1/customers/identities/resolve
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/customers/identities/resolve

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
requeststringYesIdentity resolution parameters - must specify one authentication method

Example:

curl --location --request POST 'https://api.martianpay.com/v1/customers/identities/resolve' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"customer_id": "cus_abc123",
"stripe_customer_id": "cus_stripe_xyz",
"email": "user@example.com",
"phone": "+1234567890",
"uuid": "2b3deaec-bfe4-4519-9fcf-6248215f158e",
"addresses": [],
"tax_regions": [],
"auth_token": "auth_token_abc123",
"issued_by": "instagram_bot",
"provider": "instagram",
"order_id": "ord_abc123",
"is_saved_customer": true,
"payermax_customer_id": "pm_cust_123"
}
}

Response Parameter Description:

ParameterTypeDescription
customer_idstringMartianPay customer identifier
stripe_customer_idstringAssociated Stripe customer ID if applicable
emailstringCustomer's email address
phonestringCustomer's phone number
uuidstringMerchant-assigned unique identifier for the customer
addressesarrayCustomer's saved addresses (always returns array, empty if none)
tax_regionsarrayCustomer's tax regions (always returns array, empty if none)
auth_tokenstringAuthentication token for session (returned when refresh_token=true)
issued_bystringSystem or service that issued the authentication
providerstringChannel or platform identifier
order_idstringMerchant order ID associated with this authentication
is_saved_customerbooleanIndicates if customer has been saved (has stripe_customer_id)
payermax_customer_idstringAssociated PayerMax customer ID if applicable

[Refer to the API documentation for complete response schema]

Payment Intent APIs

11. Create Payment Intent

For detailed API reference, see: Create Payment Intent API

FieldValue
API NameCreate Payment Intent
API Endpoint/v1/payment_intents
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payment_intents

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Body (JSON):

{
"amount": "100.00",
"currency": "USD",
"customer": "cus_7p51tXM7GBi7sz5J",
"description": "Payment for Order #123",
"metadata": {
"order_id": "order_123",
"customer_name": "John Doe"
},
"merchant_order_id": "order_1234",
"payment_method_type": "crypto"
}

Request Parameter Description:

ParameterTypeDescription
amountstringTransaction amount (in the specified currency)
currencystringCurrency code (e.g., USD, EUR)
customerstringCustomer ID (optional)
descriptionstringDescription of the payment (optional)
metadataobjectAdditional metadata for the payment intent (optional)
merchant_order_idstringMerchant's order ID (optional)
payment_method_typestringPayment method type (e.g., crypto)

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payment_intents' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"amount": "100.00",
"currency": "USD",
"customer": "cus_7p51tXM7GBi7sz5J",
"description": "Payment for Order #123",
"metadata": {
"order_id": "order_123",
"customer_name": "John Doe"
},
"merchant_order_id": "order_1234",
"payment_method_type": "crypto"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "pi_NKYVrCoNF340AnUAam7tghbz",
"object": "payment_intent",
"amount": {
"asset_id": "USD",
"amount": "100"
},
"payment_details": {
"amount_captured": {
"asset_id": "USD",
"amount": "0"
},
"amount_refunded": {
"asset_id": "USD",
"amount": "0"
},
"tx_fee": {
"asset_id": "USD",
"amount": "0"
},
"tax_fee": {
"asset_id": "USD",
"amount": "0"
},
"frozen_amount": {
"asset_id": "USD",
"amount": "0"
},
"net_amount": {
"asset_id": "USD",
"amount": "0"
},
"gas_fee": {},
"network_fee": {
"asset_id": "USD",
"amount": "0"
}
},
"canceled_at": 0,
"cancellation_reason": "",
"client_secret": "pi_NKYVrCoNF340AnUAam7tghbz_secret_SvEYW0QGbP60JWp1IJRxwSPkv",
"created": 1748440360,
"updated": 1748440360,
"currency": "USD",
"customer": {
"id": "cus_7p51tXM7GBi7sz5J",
"object": "customer",
"total_expense": 490,
"total_payment": 580,
"total_refund": 90,
"currency": "USD",
"created": 1737964162,
"name": "John Doe",
"email": "john@example.com",
"description": "VIP customer",
"metadata": {
"source": "web",
"user_id": "123"
},
"phone": "+1234567890"
},
"description": "Payment for order #123",
"livemode": false,
"metadata": {
"customer_name": "John Doe",
"order_id": "order_123"
},
"payment_link_details": null,
"merchant_order_id": "order_123",
"payment_method_type": "",
"charges": [],
"receipt_email": "",
"status": "RequiresPaymentMethod",
"payment_intent_status": "Created",
"complete_on_first_payment": false,
"permanent_deposit": false,
"permanent_deposit_asset_id": "",
"expired_at": 0
}
}

Response Parameter Description:

PaymentIntent Structure Description

ParameterTypeDescription
idstringUnique identifier for the payment intent
objectstringObject type, fixed value: payment_intent
amountAssetAmountPayment amount details
payment_detailsPaymentDetailsPayment details (including fees, taxes, net amount, etc.)
canceled_atint64Cancellation timestamp (0 if not canceled)
cancellation_reasonstringCancellation reason
client_secretstringClient secret
createdint64Creation timestamp
updatedint64Update timestamp
currencystringCurrency code (e.g., USD)
customerCustomerCustomer information
descriptionstringPayment intent description
livemodeboolWhether it's in production mode (true: production, false: test)
metadatamap[string]interfaceAdditional metadata
payment_link_detailsPaymentLinkDetailsPayment link details
merchant_order_idstringMerchant order ID
payment_method_typePaymentMethodTypePayment method type (crypto, visa, mastercard, etc.)
chargesCharge[]List of charge details related to the payment intent
receipt_emailstringReceipt email
statusstringStatus description
payment_intent_statusPaymentIntentStatusCurrent status enum value for the payment intent
complete_on_first_paymentboolComplete payment immediately when first transaction arrives, regardless of amount
permanent_depositboolIndicates if this payment is a permanent deposit
permanent_deposit_asset_idstringAsset ID for the permanent deposit
expired_atuint64Expiration timestamp for the payment intent
unfreeze_withdraws[]UnfreezeWithdrawArray of unfreeze withdrawal records for previously frozen funds
invoicestringInvoice ID if this payment intent is associated with an invoice
invoice_detailsInvoiceExpanded invoice details (when using expand parameter)
subscriptionstringSubscription ID resolved through the associated invoice
subscription_detailsSubscriptionExpanded subscription details (when using expand parameter)

Important Nested Structure Descriptions:

AssetAmount (Amount Details Structure)

ParameterTypeDescription
asset_idstringAsset ID (e.g., "USD", "USDC-Ethereum-TEST")
amountstringAmount value

PaymentDetails (Payment Details Structure)

ParameterTypeDescription
amount_capturedAssetAmountActual captured amount
amount_refundedAssetAmountRefunded amount
tx_feeAssetAmountTransaction fee
tax_feeAssetAmountTax fee
frozen_amountAssetAmountFrozen amount
net_amountAssetAmountNet amount
gas_feemap[string]AssetAmountMiner fee details (for each token)
network_feeAssetAmountNetwork fee

Charge (Charge Details Structure)

ParameterTypeDescription
idstringCharge ID
amountAssetAmountCharge amount details
transactionsTransactionDetails[]List of blockchain transaction details
refundedboolWhether refunded
refundsRefund[]List of refund details
createdint64Creation timestamp
payer_max_payloadPayerMaxPayloadPayerMax payment provider specific data
stripe_payloadStripePayloadStripe payment provider specific data
payment_providerstringPayment provider identifier (stripe, payer_max, or empty for crypto)
payment_method_typePaymentMethodTypePayment method type
payment_method_optionsPaymentMethodOptionsPayment method specific options

TransactionDetails (Blockchain Transaction Details)

ParameterTypeDescription
tx_idstringTransaction ID
source_addressstringSource address
destination_addressstringDestination address
tx_hashstringTransaction hash
amountstringTransaction amount
tokenstringToken name (e.g., BTC, ETH, USDT)
networkstringNetwork type (e.g., ERC20, TRC20)
created_atint64Transaction creation timestamp
statusstringTransaction status

Refund (Refund Details)

ParameterTypeDescription
idstringRefund ID
amountAssetAmountRefund amount details
transactionsTransactionDetails[]List of blockchain transactions for the refund
statusstringRefund status

12. List Payment Intents in Bulk

For detailed API reference, see: List Payment Intents API

FieldValue
API NamePayment Intent List
API Endpoint/v1/payment_intents
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/payment_intents

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters (Query String):

page=0&page_size=10&customer=cus_123456&customer_email=user@example.com&merchant_order_id=order_123

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
pageint32YesPage number, starting from 00
page_sizeint32YesNumber of items per page, at least 110
customerstringNoFilter by customer ID. If provided, customer_email is ignoredcus_123456
customer_emailstringNoFilter by customer emailuser@example.com
merchant_order_idstringNoFilter by merchant order IDorder_123

Example:

curl --location --request GET 'https://api.martianpay.com/v1/payment_intents?page=0&page_size=10&customer=cus_123456&customer_email=user@example.com' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"payment_intents": [ ... ],
"total": 1,
"page": 0,
"page_size": 20
}
}

Response Parameter Description:

Top-level structure (PaymentIntentListResp)

ParameterTypeDescription
payment_intentsPaymentIntent[]List of payment intents
totalint64Total number of records matching the criteria
pageint32Current page number (starting from 0)
page_sizeint32Number of records per page

PaymentIntent Structure Description

ParameterTypeDescription
idstringUnique identifier for the payment intent
objectstringObject type, fixed value: "payment_intent"
amountAssetAmountPayment amount details
payment_detailsPaymentDetailsPayment details (including fees, taxes, net amount, etc.)
canceled_atint64Cancellation timestamp (0 if not canceled)
cancellation_reasonstringCancellation reason
client_secretstringClient secret
createdint64Creation timestamp
updatedint64Update timestamp
currencystringCurrency code (e.g., USD)
customerCustomerCustomer information
descriptionstringPayment intent description
livemodeboolWhether it's in production mode (true: production, false: test)
metadatamap[string]interfaceAdditional metadata
payment_link_detailsPaymentLinkDetailsPayment link details
merchant_order_idstringMerchant order ID
payment_method_typePaymentMethodTypePayment method type (crypto, visa, mastercard, etc.)
chargesCharge[]List of charge details related to the payment intent
receipt_emailstringReceipt email
statusstringStatus description
payment_intent_statusPaymentIntentStatusCurrent status enum value for the payment intent
complete_on_first_paymentboolComplete payment immediately when first transaction arrives, regardless of amount
permanent_depositboolIndicates if this payment is a permanent deposit
permanent_deposit_asset_idstringAsset ID for the permanent deposit
expired_atuint64Expiration timestamp for the payment intent
unfreeze_withdraws[]UnfreezeWithdrawArray of unfreeze withdrawal records for previously frozen funds
invoicestringInvoice ID if this payment intent is associated with an invoice
invoice_detailsInvoiceExpanded invoice details (when using expand parameter)
subscriptionstringSubscription ID resolved through the associated invoice
subscription_detailsSubscriptionExpanded subscription details (when using expand parameter)

Important Nested Structure Descriptions:

AssetAmount (Amount Details Structure)

ParameterTypeDescription
asset_idstringAsset ID (e.g., "USD", "USDC-Ethereum-TEST")
amountstringAmount value

PaymentDetails (Payment Details Structure)

ParameterTypeDescription
amount_capturedAssetAmountActual captured amount
amount_refundedAssetAmountRefunded amount
tx_feeAssetAmountTransaction fee
tax_feeAssetAmountTax fee
frozen_amountAssetAmountFrozen amount
net_amountAssetAmountNet amount
gas_feemap[string]AssetAmountMiner fee details (for each token)
network_feeAssetAmountNetwork fee

Charge (Charge Details Structure)

ParameterTypeDescription
idstringCharge ID
amountAssetAmountCharge amount details
transactionsTransactionDetails[]List of blockchain transaction details
refundedboolWhether refunded
refundsRefund[]List of refund details
createdint64Creation timestamp
payer_max_payloadPayerMaxPayloadPayerMax payment provider specific data
stripe_payloadStripePayloadStripe payment provider specific data
payment_providerstringPayment provider identifier (stripe, payer_max, or empty for crypto)
payment_method_typePaymentMethodTypePayment method type
payment_method_optionsPaymentMethodOptionsPayment method specific options

TransactionDetails (Blockchain Transaction Details)

ParameterTypeDescription
tx_idstringTransaction ID
source_addressstringSource address
destination_addressstringDestination address
tx_hashstringTransaction hash
amountstringTransaction amount
tokenstringToken name (e.g., BTC, ETH, USDT)
networkstringNetwork type (e.g., ERC20, TRC20)
created_atint64Transaction creation timestamp
statusstringTransaction status

Refund (Refund Details)

ParameterTypeDescription
idstringRefund ID
amountAssetAmountRefund amount details
transactionsTransactionDetails[]List of blockchain transactions for the refund
statusstringRefund status

13. Retrieve a Single Payment Intent

For detailed API reference, see: Get Payment Intent API

FieldValue
API NameGet Single Payment Intent
API Endpoint/v1/payment_intents/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/payment_intents/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Example Request (with Payment Intent ID pi_0WE7asHes1AjF5rnIybjlcgL):

curl --location --request GET 'https://api.martianpay.com/v1/payment_intents/pi_0WE7asHes1AjF5rnIybjlcgL' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "pi_0WE7asHes1AjF5rnIybjlcgL",
"object": "payment_intent",
"amount": {
"asset_id": "USD",
"amount": "10"
},
"currency": "USD",
"status": "Completed",
"client_secret": "pi_0WE7asHes1AjF5rnIybjlcgL_secret_abc123",
"created": 1735689600,
"customer": "cus_abc123",
"description": "Payment for order #123",
"metadata": {
"order_id": "order_123"
}
}
}

14. Update Payment Intent

For detailed API reference, see: Update Payment Intent API

FieldValue
API NameUpdate Payment Intent
API Endpoint/v1/payment_intents/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payment_intents/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Body (JSON):

{
"payment_method_type": "crypto",
"payment_method_options": {
"crypto": {
"asset_id": "USDC-Ethereum-TEST"
}
}
}

Note: Replace \{id\} in the URL with the actual Payment Intent ID.

Request Parameter Description:

ParameterTypeDescription
payment_method_typestringPayment method type (e.g., crypto)
payment_method_optionsobjectOptions specific to the payment method
- cryptoobjectOptions for crypto payments
-- asset_idstringID of the asset to be used for payment (e.g., USDC-Ethereum-TEST)

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payment_intents/pi_Mv1w0RwHEnloacfnivvsktAG' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"payment_method_type": "crypto",
"payment_method_options": {
"crypto": {
"asset_id": "USDC-Ethereum-TEST"
}
}
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"payment_intents": [
{
"id": "pi_Mv1w0RwHEnloacfnivvsktAG",
"object": "payment_intent",
"amount": 100,
"amount_received": 0,
"canceled_at": -62135596800,
"cancellation_reason": "",
"client_secret": "pi_Mv1w0RwHEnloacfnivvsktAG_secret_5FB3MwZd3ki3U7fsfjw9SWwGh",
"created": 1739088184,
"currency": "USD",
"customer": "cus_7p51tXM7GBi7sz5J",
"description": "Payment for order #123",
"transactions": [],
"livemode": false,
"metadata": {
"customer_name": "John Doe",
"order_id": "order_123"
},
"payment_method_type": "crypto",
"payment_method_options": {
"crypto": {
"amount": "1000000",
"token": "USDC",
"network": "Ethereum Sepolia",
"decimals": 6,
"exchange_rate": 1,
"deposit_address": "0xA0677D28c18BaB87cDcD0cBa29DB8232E1cec854",
"expired_at": 1739090058
}
},
"charges": [
{
"id": "ch_rmwSC1uJ0NJsezyj9VsNcJla",
"object": "charge",
"amount": 100,
"amount_captured": 0,
"amount_refunded": 0,
"calculated_statement_descriptor": "",
"captured": false,
"created": 0,
"currency": "USD",
"customer": "",
"description": "",
"disputed": false,
"failure_code": "",
"failure_message": "",
"fraud_details": null,
"livemode": false,
"metadata": null,
"transactions": null,
"paid": false,
"payment_intent": "pi_Mv1w0RwHEnloacfnivvsktAG",
"payment_method_type": "crypto",
"payment_method_options": {
"crypto": {
"amount": "1000000",
"token": "USDC",
"network": "Ethereum Sepolia",
"decimals": 6,
"exchange_rate": 1,
"deposit_address": "0xA0677D28c18BaB87cDcD0cBa29DB8232E1cec854",
"expired_at": 1739090058
}
},
"receipt_email": "",
"receipt_url": "",
"refunded": false,
"refunds": null,
"review": null,
"status": ""
}
],
"receipt_email": "",
"status": "Processing"
}
],
"total": 1,
"page": 0,
"page_size": 10
}
}

Response Parameter Description:

PaymentIntent Structure Description

ParameterTypeDescription
idstringUnique identifier for the payment intent
objectstringObject type, fixed value: "payment_intent"
amountAssetAmountPayment amount details
payment_detailsPaymentDetailsPayment details (including fees, taxes, net amount, etc.)
canceled_atint64Cancellation timestamp (0 if not canceled)
cancellation_reasonstringCancellation reason
client_secretstringClient secret
createdint64Creation timestamp
updatedint64Update timestamp
currencystringCurrency code (e.g., USD)
customerCustomerCustomer information
descriptionstringPayment intent description
livemodeboolWhether it's in production mode (true: production, false: test)
metadatamap[string]interfaceAdditional metadata
payment_link_detailsPaymentLinkDetailsPayment link details
merchant_order_idstringMerchant order ID
payment_method_typePaymentMethodTypePayment method type (crypto, visa, mastercard, etc.)
chargesCharge[]List of charge details related to the payment intent
receipt_emailstringReceipt email
statusstringStatus description
payment_intent_statusPaymentIntentStatusCurrent status enum value for the payment intent
complete_on_first_paymentboolComplete payment immediately when first transaction arrives, regardless of amount
permanent_depositboolIndicates if this payment is a permanent deposit
permanent_deposit_asset_idstringAsset ID for the permanent deposit
expired_atuint64Expiration timestamp for the payment intent
unfreeze_withdraws[]UnfreezeWithdrawArray of unfreeze withdrawal records for previously frozen funds
invoicestringInvoice ID if this payment intent is associated with an invoice
invoice_detailsInvoiceExpanded invoice details (when using expand parameter)
subscriptionstringSubscription ID resolved through the associated invoice
subscription_detailsSubscriptionExpanded subscription details (when using expand parameter)

Important Nested Structure Descriptions:

AssetAmount (Amount Details Structure)

ParameterTypeDescription
asset_idstringAsset ID (e.g., "USD", "USDC-Ethereum-TEST")
amountstringAmount value

PaymentDetails (Payment Details Structure)

ParameterTypeDescription
amount_capturedAssetAmountActual captured amount
amount_refundedAssetAmountRefunded amount
tx_feeAssetAmountTransaction fee
tax_feeAssetAmountTax fee
frozen_amountAssetAmountFrozen amount
net_amountAssetAmountNet amount
gas_feemap[string]AssetAmountMiner fee details (for each token)
network_feeAssetAmountNetwork fee

Charge (Charge Details Structure)

ParameterTypeDescription
idstringCharge ID
amountAssetAmountCharge amount details
transactionsTransactionDetails[]List of blockchain transaction details
refundedboolWhether refunded
refundsRefund[]List of refund details
createdint64Creation timestamp
payer_max_payloadPayerMaxPayloadPayerMax payment provider specific data
stripe_payloadStripePayloadStripe payment provider specific data
payment_providerstringPayment provider identifier (stripe, payer_max, or empty for crypto)
payment_method_typePaymentMethodTypePayment method type
payment_method_optionsPaymentMethodOptionsPayment method specific options

TransactionDetails (Blockchain Transaction Details)

ParameterTypeDescription
tx_idstringTransaction ID
source_addressstringSource address
destination_addressstringDestination address
tx_hashstringTransaction hash
amountstringTransaction amount
tokenstringToken name (e.g., BTC, ETH, USDT)
networkstringNetwork type (e.g., ERC20, TRC20)
created_atint64Transaction creation timestamp
statusstringTransaction status

Refund (Refund Details)

ParameterTypeDescription
idstringRefund ID
amountAssetAmountRefund amount details
transactionsTransactionDetails[]List of blockchain transactions for the refund
statusstringRefund status

15. Cancel Payment Intent

For detailed API reference, see: Cancel Payment Intent API

FieldValue
API NameCancel Payment Intent
API Endpoint/v1/payment_intents/{id}/cancel
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payment_intents/{id}/cancel

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesPayment intent ID to cancel

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payment_intents/example_id/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

For detailed API reference, see: Get Payment Intent Link API

FieldValue
API NameGet Payment Intent Link
API Endpoint/v1/payment_intents/link/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payment_intents/link/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesPayment intent ID
requeststringYesPayment intent retrieval parameters

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payment_intents/link/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

For detailed API reference, see: Update Payment Intent Link API

FieldValue
API NameUpdate Payment Intent Link
API Endpoint/v1/payment_intents/link/{id}/update
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payment_intents/link/{id}/update

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesPayment intent ID
requeststringYesPayment method details with client secret or API key

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payment_intents/link/example_id/update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

18. List Customer Payment Methods

For detailed API reference, see: List Customer Payment Methods API

FieldValue
API NameList Customer Payment Methods
API Endpoint/v1/customers/payment_methods
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/customers/payment_methods

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
customer_idstringYesCustomer ID to list payment methods for

Example:

curl --location --request GET 'https://api.martianpay.com/v1/customers/payment_methods?customer_id=cus_abc123' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"payment_methods": [
{
"id": "pm_1234567890",
"provider": "stripe",
"type": "card",
"last4": "4242",
"brand": "visa",
"exp_month": 12,
"exp_year": 2025,
"funding": "credit",
"country": "US",
"fingerprint": "abc123def456"
},
{
"id": "pm_0987654321",
"provider": "stripe",
"type": "card",
"last4": "1234",
"brand": "mastercard",
"exp_month": 6,
"exp_year": 2026,
"funding": "debit",
"country": "CA",
"fingerprint": "xyz789uvw012"
}
]
}
}

Response Parameters:

ParameterTypeDescription
payment_methodsarrayList of saved payment methods for the customer
payment_methods[].idstringPayment method ID (e.g., pm_1234567890)
payment_methods[].providerstringPayment provider (stripe, paypal, etc.)
payment_methods[].typestringPayment method type (card, wallet, bank_account, etc.)
payment_methods[].last4stringLast 4 digits of the card number
payment_methods[].brandstringCard brand (visa, mastercard, amex, etc.)
payment_methods[].exp_monthintegerExpiration month
payment_methods[].exp_yearintegerExpiration year
payment_methods[].fundingstringCard funding type (credit, debit, etc.)
payment_methods[].countrystringCard issuing country (ISO 2-letter code)
payment_methods[].fingerprintstringCard fingerprint for deduplication

For detailed API reference, see: Create Payment Link API

FieldValue
API NameCreate Payment Link
API Endpoint/v1/payment_links
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payment_links

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Body (JSON):

{
"product_id": "prod_abc123",
"default_variant_id": "var_xyz789",
"primary_variant_ids": ["var_xyz789", "var_def456"],
"addon_variants": [
{
"variant_id": "var_addon123",
"min_quantity": 0,
"max_quantity": 5
}
],
"variant_config": {
"default_selection": "var_xyz789"
}
}

Request Parameter Description:

ParameterTypeRequiredDescription
product_idstringYesProduct ID to create payment link for
default_variant_idstringYesDefault variant ID to display
primary_variant_idsarrayYesArray of primary variant IDs selectable by buyer
addon_variantsarrayNoOptional add-on variants with quantity constraints
variant_configobjectNoUI and default selection metadata

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payment_links' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"product_id": "prod_abc123",
"default_variant_id": "var_xyz789",
"primary_variant_ids": ["var_xyz789", "var_def456"],
"addon_variants": [
{
"variant_id": "var_addon123",
"min_quantity": 0,
"max_quantity": 5
}
]
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "pl_abc123xyz",
"active": true,
"url": "https://pay.martianpay.com/pl_abc123xyz",
"product": {
"id": "prod_abc123",
"name": "Sample Product",
"description": "Product description"
},
"primary_variants": [
{
"variant_id": "var_xyz789",
"is_primary": true,
"quantity": 1,
"variant": {
"id": "var_xyz789",
"price": {
"amount": "29.99",
"currency": "USD"
}
}
}
],
"addon_variants": [
{
"variant_id": "var_addon123",
"min_quantity": 0,
"max_quantity": 5,
"variant": {
"id": "var_addon123",
"price": {
"amount": "5.00",
"currency": "USD"
}
}
}
],
"created_at": 1739088184,
"updated_at": 1739088184
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the payment link
activebooleanIndicates if the payment link is currently active
urlstringURL to access the payment link
productobjectProduct associated with the payment link
primary_variantsarrayPrimary variants selectable by the buyer
addon_variantsarrayOptional add-on variants
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

For detailed API reference, see: List Payment Links API

FieldValue
API NameList Payment Links
API Endpoint/v1/payment_links
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/payment_links

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters (Query String):

page=0&page_size=10&active=true&product=prod_abc123

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
pageintegerNoPage number, starting from 00
page_sizeintegerYesNumber of items per page10
activebooleanNoFilter by active statustrue
productstringNoFilter by product IDprod_abc123

Example:

curl --location --request GET 'https://api.martianpay.com/v1/payment_links?page=0&page_size=10&active=true' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"payment_links": [
{
"id": "pl_abc123xyz",
"active": true,
"url": "https://pay.martianpay.com/pl_abc123xyz",
"product": {
"id": "prod_abc123",
"name": "Sample Product"
},
"primary_variants": [],
"addon_variants": [],
"created_at": 1739088184,
"updated_at": 1739088184
}
],
"total": 1,
"page": 0,
"page_size": 10
}
}

Response Parameter Description:

ParameterTypeDescription
payment_linksarrayList of payment link objects
totalintegerTotal number of records
pageintegerCurrent page number (starting from 0)
page_sizeintegerNumber of records per page

For detailed API reference, see: Get Payment Link API

FieldValue
API NameGet Payment Link
API Endpoint/v1/payment_links/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: GET https://api.martianpay.com/v1/payment_links/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesUnique payment link IDpl_abc123xyz

Example:

curl --location --request GET 'https://api.martianpay.com/v1/payment_links/pl_abc123xyz' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "pl_abc123xyz",
"active": true,
"url": "https://pay.martianpay.com/pl_abc123xyz",
"product": {
"id": "prod_abc123",
"name": "Sample Product",
"description": "Product description",
"active": true
},
"primary_variants": [
{
"variant_id": "var_xyz789",
"is_primary": true,
"quantity": 1
}
],
"addon_variants": [],
"price_range": {
"min": "29.99",
"max": "99.99",
"currency": "USD"
},
"created_at": 1739088184,
"updated_at": 1739088184
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the payment link
activebooleanIndicates if the payment link is currently active
urlstringURL to access the payment link
productobjectProduct associated with the payment link
primary_variantsarrayPrimary variants selectable by the buyer
addon_variantsarrayOptional add-on variants
price_rangeobjectPrice range across primary variants
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

For detailed API reference, see: Update Payment Link API

FieldValue
API NameUpdate Payment Link
API Endpoint/v1/payment_links/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payment_links/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Request Body (JSON):

{
"active": false
}

Note: Payment link variant configuration cannot be modified after creation. Only the active status can be updated.

Request Parameter Description:

ParameterTypeRequiredDescription
activebooleanYesSet payment link active (true) or inactive (false)

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payment_links/pl_abc123xyz' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"active": false
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "pl_abc123xyz",
"active": false,
"url": "https://pay.martianpay.com/pl_abc123xyz",
"product": {
"id": "prod_abc123",
"name": "Sample Product"
},
"updated_at": 1739090000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the payment link
activebooleanUpdated active status
updated_atintegerLast update timestamp in Unix format

For detailed API reference, see: Delete Payment Link API

FieldValue
API NameDelete Payment Link
API Endpoint/v1/payment_links/{id}
HTTP MethodDELETE
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: DELETE https://api.martianpay.com/v1/payment_links/{id}

Request Header Example:

Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesUnique payment link IDpl_abc123xyz

Note: Only inactive payment links can be deleted. This operation cannot be undone.

Example:

curl --location --request DELETE 'https://api.martianpay.com/v1/payment_links/pl_abc123xyz' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "Payment link deleted successfully"
}

Response Parameter Description:

ParameterTypeDescription
codeintResponse code (0 for success)
error_codestringError code identifier
msgstringResponse message

Product APIs

24. Create Product

For detailed API reference, see: Create Product API

FieldValue
API NameCreate Product
API Endpoint/v1/products
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/products

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Body (JSON):

{
"name": "Premium T-Shirt",
"description": "High-quality cotton t-shirt",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": "29.99",
"currency": "USD"
},
"options": [
{
"name": "Size",
"values": [
{"value": "Small"},
{"value": "Medium"},
{"value": "Large"}
]
},
{
"name": "Color",
"values": [
{"value": "Red"},
{"value": "Blue"},
{"value": "Green"}
]
}
],
"variants": [
{
"option_values": {
"Size": "Medium",
"Color": "Blue"
},
"price": {
"amount": "29.99",
"currency": "USD"
},
"active": true,
"inventory_quantity": 100
}
],
"metadata": {
"category": "apparel",
"sku": "TSHIRT-001"
}
}

Request Parameter Description:

ParameterTypeRequiredDescription
namestringYesName of the product
descriptionstringNoDetailed description of the product
activebooleanNoProduct availability (default: true)
default_currencystringYesBase currency for the product/variants
fixed_priceobjectNoExplicit price for simple products
optionsarrayNoVariant option definitions (e.g., Size, Color)
variantsarrayNoVariant combinations with pricing
metadataobjectNoAdditional custom data for the product
collect_shipping_addressbooleanNoCollect shipping address during checkout
collect_tax_addressbooleanNoCollect billing/tax address during checkout

Example:

curl --location --request POST 'https://api.martianpay.com/v1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"name": "Premium T-Shirt",
"description": "High-quality cotton t-shirt",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": "29.99",
"currency": "USD"
},
"metadata": {
"category": "apparel"
}
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "prod_abc123",
"name": "Premium T-Shirt",
"description": "High-quality cotton t-shirt",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": "29.99",
"currency": "USD"
},
"options": [],
"variants": [],
"metadata": {
"category": "apparel"
},
"version": 1,
"created_at": 1739088184,
"updated_at": 1739088184
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the product
namestringName of the product
descriptionstringDetailed description of the product
activebooleanIndicates if the product is currently available
default_currencystringBase currency for the product/variants
fixed_priceobjectExplicit price for simple products
optionsarrayVariant option definitions
variantsarrayVariant combinations
metadataobjectAdditional custom data for the product
versionintegerCatalog version associated with this product
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

25. List Products

For detailed API reference, see: List Products API

FieldValue
API NameList Products
API Endpoint/v1/products
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/products

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters (Query String):

page=0&page_size=10&active=true

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
pageintegerNoPage number, starting from 0 (default: 0)0
page_sizeintegerNoNumber of items per page (1-50, default: 10)10
activebooleanNoFilter by active statustrue

Example:

curl --location --request GET 'https://api.martianpay.com/v1/products?page=0&page_size=10&active=true' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"products": [
{
"id": "prod_abc123",
"name": "Premium T-Shirt",
"description": "High-quality cotton t-shirt",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": "29.99",
"currency": "USD"
},
"options": [],
"variants": [],
"metadata": {
"category": "apparel"
},
"version": 1,
"created_at": 1739088184,
"updated_at": 1739088184
}
],
"total": 1,
"page": 0,
"page_size": 10
}
}

Response Parameter Description:

ParameterTypeDescription
productsarrayList of product objects
totalintegerTotal number of records
pageintegerCurrent page number (starting from 0)
page_sizeintegerNumber of records per page

26. Get Product

For detailed API reference, see: Get Product API

FieldValue
API NameGet Product
API Endpoint/v1/products/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: GET https://api.martianpay.com/v1/products/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesUnique product IDprod_abc123

Query Parameter:

ParameterTypeRequiredDescriptionExample
versionintegerNoOptional version number for historical data1

Example:

curl --location --request GET 'https://api.martianpay.com/v1/products/prod_abc123' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "prod_abc123",
"name": "Premium T-Shirt",
"description": "High-quality cotton t-shirt",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": "29.99",
"currency": "USD"
},
"options": [
{
"name": "Size",
"values": [
{"value": "Small"},
{"value": "Medium"},
{"value": "Large"}
]
}
],
"variants": [
{
"id": "var_xyz789",
"option_values": {
"Size": "Medium"
},
"price": {
"amount": "29.99",
"currency": "USD"
},
"active": true,
"inventory_quantity": 100
}
],
"metadata": {
"category": "apparel"
},
"version": 1,
"created_at": 1739088184,
"updated_at": 1739088184
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the product
namestringName of the product
descriptionstringDetailed description of the product
activebooleanIndicates if the product is currently available
default_currencystringBase currency for the product/variants
fixed_priceobjectExplicit price for simple products
optionsarrayVariant option definitions
variantsarrayVariant combinations with full details
metadataobjectAdditional custom data for the product
versionintegerCatalog version associated with this product
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

27. Update Product

For detailed API reference, see: Update Product API

FieldValue
API NameUpdate Product
API Endpoint/v1/products/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/products/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Request Body (JSON):

{
"name": "Premium T-Shirt Updated",
"description": "Updated description",
"active": true,
"fixed_price": {
"amount": "34.99",
"currency": "USD"
},
"version": 1
}

Note: Replace \{id\} in the URL with the actual Product ID. The version field is required for optimistic locking.

Request Parameter Description:

ParameterTypeRequiredDescription
namestringNoUpdated product name
descriptionstringNoUpdated product description
activebooleanNoUpdated product availability
fixed_priceobjectNoUpdated price for simple products
optionsarrayNoUpdated variant option definitions
variantsarrayNoUpdated variant combinations
metadataobjectNoUpdated custom data
versionintegerYesCurrent version for optimistic locking

Example:

curl --location --request POST 'https://api.martianpay.com/v1/products/prod_abc123' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"name": "Premium T-Shirt Updated",
"description": "Updated description",
"active": true,
"version": 1
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "prod_abc123",
"name": "Premium T-Shirt Updated",
"description": "Updated description",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": "34.99",
"currency": "USD"
},
"options": [],
"variants": [],
"metadata": {},
"version": 2,
"created_at": 1739088184,
"updated_at": 1739090000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the product
versionintegerIncremented version number after update
updated_atintegerLast update timestamp in Unix format

28. Delete Product

For detailed API reference, see: Delete Product API

FieldValue
API NameDelete Product
API Endpoint/v1/products/{id}
HTTP MethodDELETE
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: DELETE https://api.martianpay.com/v1/products/{id}

Request Header Example:

Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesUnique product IDprod_abc123

Note: Only inactive products that are not used in any payment links can be deleted. This operation cannot be undone.

Example:

curl --location --request DELETE 'https://api.martianpay.com/v1/products/prod_abc123' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "Product deleted successfully"
}

Response Parameter Description:

ParameterTypeDescription
codeintResponse code (0 for success)
error_codestringError code identifier
msgstringResponse message

29. Create Selling Plan Group

For detailed API reference, see: Create Selling Plan Group API

FieldValue
API NameCreate Selling Plan Group
API Endpoint/v1/selling_plan_groups
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/selling_plan_groups

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
requeststringYesSelling plan group parameters

Example:

curl --location --request POST 'https://api.martianpay.com/v1/selling_plan_groups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

30. List Selling Plan Groups

For detailed API reference, see: List Selling Plan Groups API

FieldValue
API NameList Selling Plan Groups
API Endpoint/v1/selling_plan_groups
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/selling_plan_groups

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
statusstringNoFilter by status (active, disabled)
offsetintegerNoPagination offset (default: 0)
limitintegerNoPagination limit (default: 50, max: 100)

Example:

curl --location --request GET 'https://api.martianpay.com/v1/selling_plan_groups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

31. Get Selling Plan Group

For detailed API reference, see: Get Selling Plan Group API

FieldValue
API NameGet Selling Plan Group
API Endpoint/v1/selling_plan_groups/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/selling_plan_groups/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesSelling plan group ID
include_plansbooleanNoInclude associated selling plans in response

Example:

curl --location --request GET 'https://api.martianpay.com/v1/selling_plan_groups/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

32. Update Selling Plan Group

For detailed API reference, see: Update Selling Plan Group API

FieldValue
API NameUpdate Selling Plan Group
API Endpoint/v1/selling_plan_groups/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/selling_plan_groups/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesSelling plan group ID
requeststringYesUpdated selling plan group parameters

Example:

curl --location --request POST 'https://api.martianpay.com/v1/selling_plan_groups/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

33. Delete Selling Plan Group

For detailed API reference, see: Delete Selling Plan Group API

FieldValue
API NameDelete Selling Plan Group
API Endpoint/v1/selling_plan_groups/{id}
HTTP MethodDELETE
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: DELETE https://api.martianpay.com/v1/selling_plan_groups/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesSelling plan group ID

Example:

curl --location --request DELETE 'https://api.martianpay.com/v1/selling_plan_groups/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

34. Create Selling Plan

For detailed API reference, see: Create Selling Plan API

FieldValue
API NameCreate Selling Plan
API Endpoint/v1/selling_plans
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/selling_plans

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
requeststringYesSelling plan parameters including billing policy and optional pricing policy

Example:

curl --location --request POST 'https://api.martianpay.com/v1/selling_plans' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

35. List Selling Plans

For detailed API reference, see: List Selling Plans API

FieldValue
API NameList Selling Plans
API Endpoint/v1/selling_plans
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/selling_plans

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
group_idstringNoFilter by selling plan group ID
statusstringNoFilter by status (active, disabled)
offsetintegerNoPagination offset (default: 0)
limitintegerNoPagination limit (default: 50, max: 100)

Example:

curl --location --request GET 'https://api.martianpay.com/v1/selling_plans' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

36. Get Selling Plan

For detailed API reference, see: Get Selling Plan API

FieldValue
API NameGet Selling Plan
API Endpoint/v1/selling_plans/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/selling_plans/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesSelling plan ID

Example:

curl --location --request GET 'https://api.martianpay.com/v1/selling_plans/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

37. Update Selling Plan

For detailed API reference, see: Update Selling Plan API

FieldValue
API NameUpdate Selling Plan
API Endpoint/v1/selling_plans/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/selling_plans/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesSelling plan ID
requeststringYesUpdated selling plan parameters

Example:

curl --location --request POST 'https://api.martianpay.com/v1/selling_plans/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

38. Delete Selling Plan

For detailed API reference, see: Delete Selling Plan API

FieldValue
API NameDelete Selling Plan
API Endpoint/v1/selling_plans/{id}
HTTP MethodDELETE
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: DELETE https://api.martianpay.com/v1/selling_plans/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesSelling plan ID

Example:

curl --location --request DELETE 'https://api.martianpay.com/v1/selling_plans/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

39. Calculate Selling Plan Price

For detailed API reference, see: Calculate Selling Plan Price API

FieldValue
API NameCalculate Selling Plan Price
API Endpoint/v1/selling_plans/calculate_price
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/selling_plans/calculate_price

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
requeststringYesPrice calculation parameters (either variant_id or base_price+currency)

Example:

curl --location --request POST 'https://api.martianpay.com/v1/selling_plans/calculate_price' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

Subscription APIs

40. List Subscriptions

For detailed API reference, see: List Subscriptions API

FieldValue
API NameList Subscriptions
API Endpoint/v1/subscriptions
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/subscriptions

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters (Query String):

offset=0&limit=20&customer_id=cus_123456&status=active&external_id=ext_123

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
offsetintegerNoPagination offset (default: 0)0
limitintegerNoPagination limit (default: 20, max: 100)20
customer_idstringNoFilter by customer IDcus_123456
statusstringNoFilter by status (incomplete, active, paused, past_due, canceled)active
external_idstringNoFilter by external ID for linking to your systemext_123

Example:

curl --location --request GET 'https://api.martianpay.com/v1/subscriptions?offset=0&limit=20&status=active' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"data": [
{
"id": "sub_abc123",
"customer_id": "cus_123456",
"customer_name": "John Doe",
"customer_email": "john@example.com",
"product_id": "prod_xyz789",
"product_name": "Monthly Subscription",
"variant_id": "var_def456",
"selling_plan_id": "sp_ghi789",
"status": "active",
"current_period_start": 1739088184,
"current_period_end": 1741766584,
"next_charge_amount": "29.99",
"created_at": 1739088184,
"updated_at": 1739088184
}
],
"total": 1,
"offset": 0,
"limit": 20
}
}

Response Parameter Description:

ParameterTypeDescription
dataarrayList of subscription objects
totalintegerTotal number of subscriptions
offsetintegerCurrent pagination offset
limitintegerNumber of records per page

Subscription Object Parameters:

ParameterTypeDescription
idstringUnique identifier for the subscription
customer_idstringCustomer ID
customer_namestringCustomer name for display
customer_emailstringCustomer email for display
product_idstringProduct ID
product_namestringProduct name for display
variant_idstringVariant ID
selling_plan_idstringSelling plan ID
statusstringSubscription status
current_period_startintegerUnix timestamp for current period start
current_period_endintegerUnix timestamp for current period end
next_charge_amountstringAmount for next payment
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

41. Get Subscription

For detailed API reference, see: Get Subscription API

FieldValue
API NameGet Subscription
API Endpoint/v1/subscriptions/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: GET https://api.martianpay.com/v1/subscriptions/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesUnique subscription IDsub_abc123

Example:

curl --location --request GET 'https://api.martianpay.com/v1/subscriptions/sub_abc123' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "sub_abc123",
"customer_id": "cus_123456",
"customer_name": "John Doe",
"customer_email": "john@example.com",
"product_id": "prod_xyz789",
"product_name": "Monthly Subscription",
"product_description": "Premium monthly plan",
"variant_id": "var_def456",
"variant_title": "Standard Plan",
"selling_plan_id": "sp_ghi789",
"selling_plan_name": "Monthly Billing",
"status": "active",
"current_period_start": 1739088184,
"current_period_end": 1741766584,
"billing_cycle_anchor": 1739088184,
"next_charge_amount": "29.99",
"cancel_at_period_end": false,
"created_at": 1739088184,
"updated_at": 1739088184
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the subscription
customer_idstringCustomer ID
customer_namestringCustomer name for display
customer_emailstringCustomer email for display
product_idstringProduct ID
product_namestringProduct name for display
product_descriptionstringProduct description for display
variant_idstringVariant ID
variant_titlestringVariant title
selling_plan_idstringSelling plan ID
selling_plan_namestringSelling plan name for display
statusstringSubscription status
current_period_startintegerUnix timestamp for current period start
current_period_endintegerUnix timestamp for current period end
billing_cycle_anchorintegerUnix timestamp for billing cycle anchor
next_charge_amountstringAmount for next payment
cancel_at_period_endbooleanWhether subscription will be canceled at period end
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

42. Cancel Subscription

For detailed API reference, see: Cancel Subscription API

FieldValue
API NameCancel Subscription
API Endpoint/v1/subscriptions/{id}/cancel
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/subscriptions/{id}/cancel

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Request Body (JSON):

{
"cancel_at_period_end": true,
"cancel_reason": "Customer requested cancellation"
}

Request Parameter Description:

ParameterTypeRequiredDescription
cancel_at_period_endbooleanNotrue=cancel at period end, false=cancel immediately (default: true)
cancel_reasonstringNoCancellation reason

Example:

curl --location --request POST 'https://api.martianpay.com/v1/subscriptions/sub_abc123/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"cancel_at_period_end": true,
"cancel_reason": "Customer requested cancellation"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "sub_abc123",
"status": "active",
"cancel_at_period_end": true,
"cancel_reason": "Customer requested cancellation",
"canceled_at": 1739090000,
"current_period_end": 1741766584,
"updated_at": 1739090000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the subscription
statusstringSubscription status
cancel_at_period_endbooleanWhether subscription will be canceled at period end
cancel_reasonstringCancellation reason
canceled_atintegerCancellation timestamp in Unix format
current_period_endintegerUnix timestamp for current period end
updated_atintegerLast update timestamp in Unix format

43. Pause Subscription

For detailed API reference, see: Pause Subscription API

FieldValue
API NamePause Subscription
API Endpoint/v1/subscriptions/{id}/pause
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/subscriptions/{id}/pause

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Request Body (JSON):

{
"behavior": "void",
"resumes_at": 1744274184
}

Request Parameter Description:

ParameterTypeRequiredDescription
behaviorstringYes"void" or "keep_as_draft" (default: "void")
resumes_atintegerNoUnix timestamp for automatic resumption

Example:

curl --location --request POST 'https://api.martianpay.com/v1/subscriptions/sub_abc123/pause' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"behavior": "void",
"resumes_at": 1744274184
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "sub_abc123",
"status": "paused",
"pause_collection_behavior": "void",
"paused_at": 1739090000,
"resumes_at": 1744274184,
"updated_at": 1739090000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the subscription
statusstringSubscription status (should be "paused")
pause_collection_behaviorstringPause behavior setting
paused_atintegerPause timestamp in Unix format
resumes_atintegerUnix timestamp for automatic resumption
updated_atintegerLast update timestamp in Unix format

44. Resume Subscription

For detailed API reference, see: Resume Subscription API

FieldValue
API NameResume Subscription
API Endpoint/v1/subscriptions/{id}/resume
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: POST https://api.martianpay.com/v1/subscriptions/{id}/resume

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Example:

curl --location --request POST 'https://api.martianpay.com/v1/subscriptions/sub_abc123/resume' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "sub_abc123",
"status": "active",
"pause_collection_behavior": "",
"paused_at": 0,
"resumes_at": 0,
"updated_at": 1739092000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the subscription
statusstringSubscription status (should be "active")
pause_collection_behaviorstringCleared pause behavior setting
paused_atintegerCleared pause timestamp
resumes_atintegerCleared resume timestamp
updated_atintegerLast update timestamp in Unix format

45. Update Subscription (Plan Change)

For detailed API reference, see: Update Subscription API

FieldValue
API NameUpdate Subscription
API Endpoint/v1/subscriptions/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/subscriptions/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Request Body (JSON):

{
"primary_variant": {
"selling_plan_id": "sp_newplan456"
},
"proration_behavior": "always_invoice",
"billing_cycle_anchor": "now"
}

Request Parameter Description:

ParameterTypeRequiredDescription
primary_variantobjectYesThe primary variant selection to update
primary_variant.selling_plan_idstringYesThe new selling plan ID to switch to
primary_variant.variant_idstringNoThe new variant ID (optional)
primary_variant.quantityintegerNoQuantity (default: 1)
proration_behaviorstringNoHow proration is handled (see details below)
proration_dateintegerNoUnix timestamp for custom proration calculation (see details below)
billing_cycle_anchorstringNoControls billing cycle timing (see details below)
metadataobjectNoKey-value pairs for additional information

Parameter Details:

proration_behavior - Controls how proration charges are handled during plan changes.

Values:

  • "always_invoice": Create an invoice immediately for the prorated amount. Customer is charged right away.
  • "create_prorations": Defer the plan change to next billing cycle (used for deferred upgrades).
  • "none": No proration calculation. Only valid for downgrades.

Default behavior (when not specified):

  • Upgrades: "always_invoice" (immediate charge with credit for unused time on old plan)
  • Downgrades: "none" (no charge, change takes effect at period end)

VALID COMBINATIONS (other combinations return error invalid_proration_config):

For UPGRADES (3 valid combinations):

proration_behaviorbilling_cycle_anchorResult
always_invoicenowImmediate upgrade, charge now, reset cycle
always_invoiceunchangedImmediate upgrade, charge now, keep cycle
create_prorationsunchangedDeferred upgrade, change at period end

For DOWNGRADES (1 valid combination):

proration_behaviorbilling_cycle_anchorResult
noneunchangedDeferred downgrade, change at period end

INVALID COMBINATIONS (return error):

  • create_prorations + now: Would reset cycle without settling, customer credit lost
  • none + now/unchanged (upgrade): Would give customer free upgrade
  • any + now (downgrade): Downgrade cannot take effect immediately

billing_cycle_anchor - Controls when the new billing cycle starts after a plan change.

Values:

  • "now": Reset billing cycle immediately. New period starts from the change time.
  • "unchanged": Keep current billing cycle anchor.

Default behavior (when not specified):

  • Upgrades: "now" (billing cycle resets to start fresh)
  • Downgrades: Must be "unchanged" (downgrades always take effect at period end)

NOTE: For downgrades, only "unchanged" is valid. Using "now" will return an error. See proration_behavior documentation for valid combinations.

proration_date - A Unix timestamp (seconds) for custom proration calculation (backdating).

When provided, proration credits are calculated as if the plan change happened at this time instead of now.

How it works:

  • The remaining time on the old plan is calculated from proration_date to current_period_end
  • Credit = (old_plan_price) × (remaining_time / total_period_time)
  • This allows backdating: if a customer requested a change yesterday, you can use yesterday's timestamp

Constraints:

  • Must be within the current billing period (between current_period_start and current_period_end)
  • If not specified, current time (now) is used for calculation

Example: If period is Dec 1-31 and proration_date is Dec 15, customer gets credit for 16 remaining days.

Example:

curl --location --request POST 'https://api.martianpay.com/v1/subscriptions/sub_abc123' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"primary_variant": {
"selling_plan_id": "sp_newplan456"
},
"proration_behavior": "always_invoice",
"billing_cycle_anchor": "now"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "sub_abc123",
"status": "active",
"selling_plan_id": "sp_newplan456",
"selling_plan_name": "Premium Monthly",
"applied": true,
"is_upgrade": true,
"effective_date": 1739090000,
"charge_today": "66.66",
"proration_behavior": "always_invoice",
"proration_date": 1739090000,
"proration_credit": "33.33",
"proration_details": {
"current_price": "4999",
"target_price": "9999",
"days_remaining": 20,
"total_days": 30,
"credited_amount": "3333",
"charged_amount": "6666",
"net_amount": "3333"
},
"pending_update": null,
"next_charge_amount": "99.99",
"next_charge_date": 1741766584,
"updated_at": 1739090000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the subscription
statusstringSubscription status
selling_plan_idstringNew selling plan ID
selling_plan_namestringNew selling plan name
appliedbooleantrue=change applied, false=preview only
is_upgradebooleantrue=upgrade, false=downgrade
effective_dateintegerUnix timestamp when change takes effect
charge_todaystringNet amount charged today
proration_behaviorstringHow proration was handled
proration_dateintegerTimestamp used for proration calculation
proration_creditstringCredit for unused time on old plan
proration_detailsobjectDetailed proration breakdown
pending_updateobjectScheduled changes for downgrades (null for immediate)
next_charge_amountstringAmount for next payment
next_charge_dateintegerUnix timestamp for next billing
updated_atintegerLast update timestamp

Proration Details Object:

ParameterTypeDescription
current_pricestringCurrent plan price in cents
target_pricestringTarget plan price in cents
days_remainingintegerDays remaining in current period
total_daysintegerTotal days in billing period
credited_amountstringCredit for unused time (cents)
charged_amountstringCharge for new plan's time (cents)
net_amountstringNet amount: charged - credited (cents)

Pending Update Object (for downgrades):

ParameterTypeDescription
target_selling_plan_idstringSelling plan to change to
target_selling_plan_namestringName of target selling plan
target_variant_idstringVariant to change to (if specified)
target_variant_titlestringDisplay title of target variant
target_variant_pricestringBase price of target variant
change_typestring"upgrade" or "downgrade"
effective_dateintegerUnix timestamp when change takes effect
scheduled_atintegerUnix timestamp when update was scheduled
proration_behaviorstringHow proration will be handled
next_charge_amountstringAmount after change takes effect
billing_cycle_anchorstringBilling cycle timing setting

46. Preview Subscription Update

For detailed API reference, see: Preview Subscription Update API

FieldValue
API NamePreview Subscription Update
API Endpoint/v1/subscriptions/{id}/preview
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/subscriptions/{id}/preview

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

Request Body (JSON):

{
"primary_variant": {
"selling_plan_id": "sp_newplan456"
},
"proration_behavior": "always_invoice",
"billing_cycle_anchor": "now"
}

Request Parameter Description:

Same as Update Subscription API.

Example:

curl --location --request POST 'https://api.martianpay.com/v1/subscriptions/sub_abc123/preview' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"primary_variant": {
"selling_plan_id": "sp_newplan456"
},
"proration_behavior": "always_invoice",
"billing_cycle_anchor": "now"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "sub_abc123",
"status": "active",
"applied": false,
"is_upgrade": true,
"effective_date": 1739090000,
"charge_today": "66.66",
"proration_behavior": "always_invoice",
"proration_date": 1739090000,
"proration_credit": "33.33",
"proration_details": {
"current_price": "4999",
"target_price": "9999",
"days_remaining": 20,
"total_days": 30,
"credited_amount": "3333",
"charged_amount": "6666",
"net_amount": "3333"
},
"next_charge_amount": "99.99",
"next_charge_date": 1741766584
}
}

Response Parameter Description:

Same as Update Subscription API response, with key difference:

  • applied is always false for preview (no changes made)

Note: Preview does not modify the subscription, create invoices, or charge the customer. Use this to show customers what they'll be charged before confirming plan changes.

Customer Structure

ParameterTypeDescription
idstringUnique customer ID
objectstringObject type, fixed value: "customer"
total_expenseint64Total actual spending by the customer (in the smallest currency unit, e.g., cents)
total_paymentint64Total payment by the customer (in the smallest currency unit)
total_refundint64Total refund by the customer (in the smallest currency unit)
currencystringCustomer currency code (e.g., USD), optional
createdint64Customer creation timestamp (Unix), optional
namestring (optional)Customer name
emailstring (optional)Customer email address
descriptionstring (optional)Customer description (such as notes, special tags)
metadatamap[string]stringAdditional customer metadata (custom key-value pairs), optional
phonestring (optional)Customer phone number

47. List Invoices

For detailed API reference, see: List Invoices API

FieldValue
API NameList Invoices
API Endpoint/v1/customers/me/invoices
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/customers/me/invoices

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
subscription_idstringNoFilter by subscription ID
statusstringNoFilter by invoice status (draft, open, paid, void, uncollectible)
offsetintegerNoPagination offset (default: 0)
limitintegerNoPagination limit (default: 20, max: 100)

Example:

curl --location --request GET 'https://api.martianpay.com/v1/customers/me/invoices' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

48. Get Invoice

For detailed API reference, see: Get Invoice API

FieldValue
API NameGet Invoice
API Endpoint/v1/customers/me/invoices/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/customers/me/invoices/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesInvoice ID

Example:

curl --location --request GET 'https://api.martianpay.com/v1/customers/me/invoices/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

47. Get Invoice Payment Intent

For detailed API reference, see: Get Invoice Payment Intent API

FieldValue
API NameGet Invoice Payment Intent
API Endpoint/v1/customers/me/invoices/{id}/payment_intent
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/customers/me/invoices/{id}/payment_intent

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesInvoice ID

Example:

curl --location --request GET 'https://api.martianpay.com/v1/customers/me/invoices/example_id/payment_intent' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

48. Get Invoice PDF

For detailed API reference, see: Get Invoice PDF API

FieldValue
API NameGet Invoice PDF
API Endpoint/v1/customers/me/invoices/{id}/pdf
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/customers/me/invoices/{id}/pdf

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesInvoice ID

Example:

curl --location --request GET 'https://api.martianpay.com/v1/customers/me/invoices/example_id/pdf' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

49. Send Invoice Email

For detailed API reference, see: Send Invoice Email API

FieldValue
API NameSend Invoice Email
API Endpoint/v1/invoices/{id}/send
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/invoices/{id}/send

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesInvoice ID

Example:

curl --location --request POST 'https://api.martianpay.com/v1/invoices/example_id/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

50. Void Invoice

For detailed API reference, see: Void Invoice API

FieldValue
API NameVoid Invoice
API Endpoint/v1/invoices/{id}/void
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/invoices/{id}/void

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesInvoice ID

Example:

curl --location --request POST 'https://api.martianpay.com/v1/invoices/example_id/void' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

Refund APIs

51. Create Refund

For detailed API reference, see: Create Refund API

Request Method: POST

Request Path: https://api.martianpay.com/v1/refunds

Request Parameters (JSON body):

ParameterTypeRequiredDescriptionExample
amountstringYesRefund amount10
metadataobjectNoCustom key-value pairs
payment_intent_idstringYes*Payment Intent IDpi_0QIQ4rIePsb23lUguKBsIVKS
reasonstringNoReason for the refundrequested_by_customer

Request Example (cURL):

curl --location --request POST 'https://api.martianpay.com/v1/refunds' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"amount": "10",
"metadata": {
"order_id": "order_123",
"customer_name": "John Doe"
},
"payment_intent_id": "pi_0QIQ4rIePsb23lUguKBsIVKS",
"reason": "requested_by_customer"
}'

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"refunds": [
{
"id": "rf_KRFVq8IpoMY40Tt143NInoYw",
"object": "refund",
"amount": 100,
"created": -62135596800,
"currency": "USD",
"description": "",
"transactions": [],
"failure_reason": "",
"metadata": {
"customer_name": "John Doe",
"order_id": "order_123"
},
"charge": "ch_rmwSC1uJ0NJsezyj9VsNcJla",
"payment_intent": "pi_Mv1w0RwHEnloacfnivvsktAG",
"refund_address": "0x36279Ac046498bF0cb742622cCe22F3cE3c2AfD9",
"reason": "requested_by_customer",
"status": "Pending"
}
]
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the refund
objectstringObject type, always "refund"
amountintRefunded amount in smallest currency unit
createdint64Timestamp of refund creation (Unix time)
currencystringCurrency code of the refund (e.g., USD)
descriptionstringDescription of the refund
transactionsarrayList of blockchain transactions for refund
failure_reasonstringReason for refund failure, if applicable
metadataTransactionDetails[]Additional custom metadata
chargestringID of the related charge
payment_intentstringID of the related payment intent
refund_addressstringBlockchain address for the refund
reasonstringReason for the refund
statusstringCurrent status of the refund

TransactionDetails (Blockchain Transaction Details)

ParameterTypeDescription
tx_idstringTransaction ID
source_addressstringSource address
destination_addressstringDestination address
tx_hashstringTransaction hash
amountstringTransaction amount
tokenstringToken name (e.g., BTC, ETH, USDT)
networkstringNetwork type (e.g., ERC20, TRC20)
created_atint64Transaction creation timestamp
statusstringTransaction status

52. Retrieve a Single Refund

For detailed API reference, see: Get Refund API

Request Method: GET

Request Path: https://api.martianpay.com/v1/refunds/{id}

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesUnique refund IDrf_EOexm0yBhLJQhVklANxxnvdX

Request Example (cURL):

curl --location --request GET 'https://api.martianpay.com/v1/refunds/rf_EOexm0yBhLJQhVklANxxnvdX' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "rf_EOexm0yBhLJQhVklANxxnvdX",
"object": "refund",
"amount": 1000,
"created": 1631234567,
"currency": "USD",
"description": "Refund for order #12345",
"transactions": [
{
"tx_id": "tx_123456",
"source_address": "0x1234...",
"destination_address": "0x5678...",
"tx_hash": "0xabcd...",
"amount": "10.00",
"token": "USDT",
"network": "ERC20",
"created_at": 1631234568,
"status": "completed"
}
],
"failure_reason": "",
"metadata": {
"order_id": "12345"
},
"charge": "ch_abc123",
"payment_intent": "pi_def456",
"refund_address": "0x9876...",
"reason": "requested_by_customer",
"status": "succeeded"
}
}

Response Parameter Description:

(Same as the "Create Refund" response parameters)

53. List Refunds

For detailed API reference, see: List Refunds API

Request Method: GET

Request Path: https://api.martianpay.com/v1/refunds

Request Parameters (Query String):

ParameterTypeRequiredDescriptionExample
pageintYesPage number, starting from 00
page_sizeintYesNumber of records per page10
payment_intentstringNoFilter by payment intent IDpi_MUIAfkuFgzbdaPubOpimfXLD

Request Example (cURL):

curl --location --request GET 'https://api.martianpay.com/v1/refunds?page=0&page_size=10&payment_intent=pi_MUIAfkuFgzbdaPubOpimfXLD' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Structure (JSON):

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"refunds": [
{
"id": "rf_EOexm0yBhLJQhVklANxxnvdX",
"object": "refund",
"amount": 10,
"created": 1739104223,
"currency": "USD",
"description": "",
"transactions": [
{
"source_address": "0xA0C8583f722339Dd4179D34A93Bae139424cB81e",
"destination_address": "0x36279Ac046498bF0cb742622cCe22F3cE3c2AfD9",
"tx_hash": "0x24459dea89852c6e69058926033a27afff0fd90c3de8604b06ce15d9e26ee715",
"amount": "100000",
"token": "USDC",
"network": "Ethereum Sepolia",
"type": "refund",
"created_at": 1739104235,
"status": "confirmed"
}
],
"failure_reason": "",
"metadata": {
"customer_name": "John Doe",
"order_id": "order_123"
},
"charge": "ch_MUkOLHxz89MqiOoKOB8bcSX7",
"payment_intent": "pi_MUIAfkuFgzbdaPubOpimfXLD",
"refund_address": "0x36279Ac046498bF0cb742622cCe22F3cE3c2AfD9",
"reason": "requested_by_customer",
"status": "Success"
}
],
"total": 1,
"page": 1,
"page_size": 10
}
}

Response Parameter Description:

ParameterTypeDescription
codeintResponse code (0 for success)
msgstringResponse message
dataobjectResponse data containing refund list
refundsarrayList of refund objects
totalintTotal number of refunds
pageintCurrent page number
page_sizeintNumber of records per page

Refund object parameters are the same as described in the "Retrieve a Single Refund" section.

Wallet/Address APIs

54. Create Wallet Address

For detailed API reference, see: Create Wallet Address API

FieldValue
API NameCreate Wallet Address
API Endpoint/v1/addresses
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/addresses

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Body (JSON):

{
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"network": "ETH"
}

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
addressstringYesThe blockchain address to create0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb
networkstringYesBlockchain network (e.g., ETH, BTC, Solana)ETH

Example:

curl --location --request POST 'https://api.martianpay.com/v1/addresses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"network": "ETH"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "addr_abc123",
"merchant_id": "merch_xyz789",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"network": "ETH",
"alias": "",
"status": "created",
"verification_id": "verify_def456",
"verification": {
"id": "verify_def456",
"merchant_address_id": "addr_abc123",
"status": "pending",
"asset_id": "USDC-Ethereum-TEST",
"aml_status": "pending",
"tried_times": 0,
"verified_at": 0
},
"created_at": 1739090000,
"updated_at": 1739090000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the merchant address
merchant_idstringID of the merchant who owns this address
addressstringThe actual blockchain address
networkstringBlockchain network (e.g., ETH, BTC)
aliasstringUser-defined name for this address
statusstringCurrent status of the address (created, verifying, success, failed)
verification_idstringReference to the verification record ID
verificationobjectNested verification details
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

Verification Object Parameters:

ParameterTypeDescription
idstringUnique identifier for the verification record
merchant_address_idstringID of the merchant address being verified
statusstringCurrent verification status
asset_idstringAsset used for verification
aml_statusstringAnti-Money Laundering status
tried_timesintegerNumber of verification attempts
verified_atintegerTimestamp when verification was completed

55. List Wallet Addresses

For detailed API reference, see: List Wallet Addresses API

FieldValue
API NameList Wallet Addresses
API Endpoint/v1/addresses
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/addresses

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Body (JSON):

{
"page": 0,
"page_size": 20,
"network": "ETH"
}

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
pageintegerNoPage number, starting from 00
page_sizeintegerYesNumber of records per page (min: 1, max: 50)20
networkstringNoFilter by blockchain network (e.g., ETH, BTC)ETH

Example:

curl --location --request GET 'https://api.martianpay.com/v1/addresses' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"page": 0,
"page_size": 20,
"network": "ETH"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"merchant_addresses": [
{
"id": "addr_abc123",
"merchant_id": "merch_xyz789",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"network": "ETH",
"alias": "Main Wallet",
"status": "success",
"verification_id": "verify_def456",
"verification": {
"id": "verify_def456",
"merchant_address_id": "addr_abc123",
"status": "verified",
"asset_id": "USDC-Ethereum-TEST",
"aml_status": "approved",
"tried_times": 1,
"verified_at": 1739091000
},
"created_at": 1739090000,
"updated_at": 1739091000
}
],
"page": 0,
"page_size": 20,
"total": 1
}
}

Response Parameter Description:

ParameterTypeDescription
merchant_addressesarrayList of merchant address objects
pageintegerCurrent page number
page_sizeintegerNumber of records per page
totalintegerTotal number of addresses

Merchant Address Object Parameters:

ParameterTypeDescription
idstringUnique identifier for the merchant address
merchant_idstringID of the merchant who owns this address
addressstringThe actual blockchain address
networkstringBlockchain network (e.g., ETH, BTC)
aliasstringUser-defined name for this address
statusstringCurrent status of the address (created, verifying, success, failed)
verification_idstringReference to the verification record ID
verificationobjectNested verification details
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

56. Get Wallet Address

For detailed API reference, see: Get Wallet Address API

FieldValue
API NameGet Wallet Address
API Endpoint/v1/addresses/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: GET https://api.martianpay.com/v1/addresses/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesMerchant address IDaddr_abc123

Example:

curl --location --request GET 'https://api.martianpay.com/v1/addresses/addr_abc123' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "addr_abc123",
"merchant_id": "merch_xyz789",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"network": "ETH",
"alias": "Main Wallet",
"status": "success",
"verification_id": "verify_def456",
"verification": {
"id": "verify_def456",
"merchant_address_id": "addr_abc123",
"status": "verified",
"asset_id": "USDC-Ethereum-TEST",
"aml_status": "approved",
"tried_times": 1,
"verified_at": 1739091000
},
"created_at": 1739090000,
"updated_at": 1739091000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the merchant address
merchant_idstringID of the merchant who owns this address
addressstringThe actual blockchain address
networkstringBlockchain network (e.g., ETH, BTC)
aliasstringUser-defined name for this address
statusstringCurrent status of the address (created, verifying, success, failed)
verification_idstringReference to the verification record ID
verificationobjectNested verification details
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

Verification Object Parameters:

ParameterTypeDescription
idstringUnique identifier for the verification record
merchant_address_idstringID of the merchant address being verified
statusstringCurrent verification status
asset_idstringAsset used for verification
aml_statusstringAnti-Money Laundering status
tried_timesintegerNumber of verification attempts
verified_atintegerTimestamp when verification was completed

57. Update Wallet Address

For detailed API reference, see: Update Wallet Address API

FieldValue
API NameUpdate Wallet Address
API Endpoint/v1/addresses/{id}
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/addresses/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesMerchant address IDaddr_abc123

Request Body (JSON):

{
"alias": "Primary ETH Wallet"
}

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
aliasstringNoUser-defined name for this addressPrimary ETH Wallet

Example:

curl --location --request POST 'https://api.martianpay.com/v1/addresses/addr_abc123' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"alias": "Primary ETH Wallet"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "addr_abc123",
"merchant_id": "merch_xyz789",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"network": "ETH",
"alias": "Primary ETH Wallet",
"status": "success",
"verification_id": "verify_def456",
"verification": {
"id": "verify_def456",
"merchant_address_id": "addr_abc123",
"status": "verified",
"asset_id": "USDC-Ethereum-TEST",
"aml_status": "approved",
"tried_times": 1,
"verified_at": 1739091000
},
"created_at": 1739090000,
"updated_at": 1739092000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the merchant address
merchant_idstringID of the merchant who owns this address
addressstringThe actual blockchain address
networkstringBlockchain network (e.g., ETH, BTC)
aliasstringUser-defined name for this address
statusstringCurrent status of the address (created, verifying, success, failed)
verification_idstringReference to the verification record ID
verificationobjectNested verification details
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

58. Delete Wallet Address

For detailed API reference, see: Delete Wallet Address API

FieldValue
API NameDelete Wallet Address
API Endpoint/v1/addresses/{id}
HTTP MethodDELETE
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)

Request URL: DELETE https://api.martianpay.com/v1/addresses/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesMerchant address IDaddr_abc123

Example:

curl --location --request DELETE 'https://api.martianpay.com/v1/addresses/addr_abc123' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "Address deleted successfully"
}

Response Parameter Description:

ParameterTypeDescription
codenumberResponse code (0 for success)
error_codestringError code identifier
msgstringHuman-readable message

59. Verify Wallet Address

For detailed API reference, see: Verify Wallet Address API

FieldValue
API NameVerify Wallet Address
API Endpoint/v1/addresses/{id}/verify
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/addresses/{id}/verify

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Path Parameter:

ParameterTypeRequiredDescriptionExample
idstringYesMerchant address IDaddr_abc123

Request Body (JSON):

{
"amount": "0.01"
}

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
amountstringYesAmount to send for verification0.01

Example:

curl --location --request POST 'https://api.martianpay.com/v1/addresses/addr_abc123/verify' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}' \
--data '{
"amount": "0.01"
}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"id": "addr_abc123",
"merchant_id": "merch_xyz789",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"network": "ETH",
"alias": "Primary ETH Wallet",
"status": "verifying",
"verification_id": "verify_def456",
"verification": {
"id": "verify_def456",
"merchant_address_id": "addr_abc123",
"status": "pending",
"asset_id": "USDC-Ethereum-TEST",
"aml_status": "pending",
"tried_times": 1,
"verified_at": 0
},
"created_at": 1739090000,
"updated_at": 1739092000
}
}

Response Parameter Description:

ParameterTypeDescription
idstringUnique identifier for the merchant address
merchant_idstringID of the merchant who owns this address
addressstringThe actual blockchain address
networkstringBlockchain network (e.g., ETH, BTC)
aliasstringUser-defined name for this address
statusstringCurrent status of the address (created, verifying, success, failed)
verification_idstringReference to the verification record ID
verificationobjectNested verification details
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format

Verification Object Parameters:

ParameterTypeDescription
idstringUnique identifier for the verification record
merchant_address_idstringID of the merchant address being verified
statusstringCurrent verification status
asset_idstringAsset used for verification
aml_statusstringAnti-Money Laundering status
tried_timesintegerNumber of verification attempts
verified_atintegerTimestamp when verification was completed

Order APIs

60. List Orders

For detailed API reference, see: List Orders API

FieldValue
API NameList Orders
API Endpoint/v1/orders
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/orders

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters (Query String):

search=order_123&status=Paid&page=1&page_size=10

Request Parameter Description:

ParameterTypeRequiredDescriptionExample
searchstringNoSearch by order number, customer name, or emailorder_123
statusstringNoFilter by status: Pending, Paid, Shipping, Refunded, CanceledPaid
pageintegerNoPage number (default: 1)1
page_sizeintegerNoItems per page (default: 10, max: 100)10

Example:

curl --location --request GET 'https://api.martianpay.com/v1/orders?page=1&page_size=10&status=Paid' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"orders": [
{
"order_number": "ord_abc123",
"external_id": "ext_c40wb",
"status": "Paid",
"created_at": 1739090000,
"updated_at": 1739092000,
"customer": {
"id": "cus_xyz789",
"name": "John Doe",
"email": "john.doe@example.com",
"phone": "+1234567890"
},
"items": [
{
"product": {
"id": "prod_abc123",
"name": "Premium T-Shirt",
"description": "High-quality cotton t-shirt",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": 29.99,
"asset_id": "USD"
},
"collect_shipping_address": true,
"collect_tax_address": false,
"created_at": 1739080000
},
"option_values": {
"Color": "Black",
"Size": "M"
},
"quantity": 2,
"unit_price": {
"amount": 29.99,
"asset_id": "USD"
},
"subtotal": {
"amount": 59.98,
"asset_id": "USD"
}
}
],
"total_amount": {
"amount": 59.98,
"asset_id": "USD"
},
"shipping_address": {
"name": "John Doe",
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
],
"total": 1,
"page": 1,
"page_size": 10
}
}

Response Parameter Description:

Top-level structure (OrderListResp)

ParameterTypeDescription
ordersOrder[]List of orders
totalintegerTotal number of records matching the criteria
pageintegerCurrent page number (starting from 1)
page_sizeintegerNumber of records per page

Order Structure Description

ParameterTypeDescription
order_numberstringUnique order identifier (e.g., ord_xxx)
external_idstringExternal system identifier for the order
statusstringOrder status (Pending, Paid, Shipping, Refunded, Canceled)
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format
customerobjectCustomer information
itemsarrayList of order items
total_amountobjectTotal order amount
shipping_addressobjectShipping address details

Customer Object

ParameterTypeDescription
idstringCustomer ID
namestringCustomer name
emailstringCustomer email
phonestringCustomer phone

Order Item Object

ParameterTypeDescription
productobjectProduct details
option_valuesobjectVariant options (e.g., Color, Size)
quantityintegerQuantity ordered
unit_priceobjectPrice per unit
subtotalobjectItem subtotal (quantity × unit_price)

Amount Object

ParameterTypeDescription
amountnumberDecimal amount value
asset_idstringCurrency/asset identifier

Shipping Address Object

ParameterTypeDescription
namestringRecipient name
line1stringAddress line 1
line2stringAddress line 2 (optional)
citystringCity
statestringState/Province
postal_codestringPostal/ZIP code
countrystringCountry code (ISO 2-letter)

61. Get Order Details

For detailed API reference, see: Get Order Details API

FieldValue
API NameGet Order Details
API Endpoint/v1/orders/{order_number}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/orders/{order_number}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Path Parameter:

ParameterTypeRequiredDescriptionExample
order_numberstringYesOrder number (e.g., ord_xxx)ord_abc123

Example:

curl --location --request GET 'https://api.martianpay.com/v1/orders/ord_abc123' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {
"order": {
"order_number": "ord_abc123",
"external_id": "ext_c40wb",
"status": "Paid",
"created_at": 1739090000,
"updated_at": 1739092000,
"customer": {
"id": "cus_xyz789",
"name": "John Doe",
"email": "john.doe@example.com",
"phone": "+1234567890"
},
"items": [
{
"product": {
"id": "prod_abc123",
"name": "Premium T-Shirt",
"description": "High-quality cotton t-shirt",
"active": true,
"default_currency": "USD",
"fixed_price": {
"amount": 29.99,
"asset_id": "USD"
},
"collect_shipping_address": true,
"collect_tax_address": false,
"created_at": 1739080000,
"metadata": {
"sku": "TSHIRT-PREM-001"
},
"options": [
{
"name": "Color",
"sort_order": 1,
"values": [
{
"value": "Black",
"sort_order": 1
},
{
"value": "White",
"sort_order": 2
}
]
},
{
"name": "Size",
"sort_order": 2,
"values": [
{
"value": "S",
"sort_order": 1
},
{
"value": "M",
"sort_order": 2
},
{
"value": "L",
"sort_order": 3
}
]
}
],
"media_order": ["media_img001"],
"includes": {
"media": [
{
"id": "media_img001",
"url": "https://cdn.example.com/tshirt-black.jpg",
"content_type": "image/jpeg",
"width": 1200,
"height": 1600,
"alt_text": "Black premium t-shirt"
}
]
}
},
"option_values": {
"Color": "Black",
"Size": "M"
},
"quantity": 2,
"unit_price": {
"amount": 29.99,
"asset_id": "USD"
},
"subtotal": {
"amount": 59.98,
"asset_id": "USD"
},
"media_order": ["media_img001"]
}
],
"subtotal": {
"amount": 59.98,
"asset_id": "USD"
},
"shipping_cost": {
"amount": 5.00,
"asset_id": "USD"
},
"tax": {
"amount": 3.25,
"asset_id": "USD"
},
"total_amount": {
"amount": 68.23,
"asset_id": "USD"
},
"shipping_address": {
"name": "John Doe",
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US",
"phone": "+1234567890"
},
"billing_address": {
"name": "John Doe",
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
},
"payment_intent_id": "pi_xyz789",
"payment_link_id": "plink_abc123",
"notes": "Please ship ASAP"
}
}
}

Response Parameter Description:

Order Object

ParameterTypeDescription
order_numberstringUnique order identifier (e.g., ord_xxx)
external_idstringExternal system identifier for the order
statusstringOrder status (Pending, Paid, Shipping, Refunded, Canceled)
created_atintegerCreation timestamp in Unix format
updated_atintegerLast update timestamp in Unix format
customerobjectCustomer information (see Customer Object below)
itemsarrayList of order items (see Order Item Object below)
subtotalobjectSubtotal before shipping and tax
shipping_costobjectShipping cost
taxobjectTax amount
total_amountobjectTotal order amount (subtotal + shipping + tax)
shipping_addressobjectShipping address details
billing_addressobjectBilling address details (optional)
payment_intent_idstringAssociated payment intent ID
payment_link_idstringAssociated payment link ID
notesstringCustomer notes or special instructions

Customer Object

ParameterTypeDescription
idstringCustomer ID
namestringCustomer name
emailstringCustomer email
phonestringCustomer phone

Order Item Object

ParameterTypeDescription
productobjectFull product details (see Product Object below)
option_valuesobjectSelected variant options (e.g., Color, Size)
quantityintegerQuantity ordered
unit_priceobjectPrice per unit (Amount Object)
subtotalobjectItem subtotal (quantity × unit_price)
media_orderarrayOrdered list of media asset IDs for this item

Product Object

ParameterTypeDescription
idstringUnique product identifier
namestringProduct name
descriptionstringDetailed product description
activebooleanWhether product is currently available
default_currencystringBase currency for the product
fixed_priceobjectPrice for simple products (Amount Object)
collect_shipping_addressbooleanWhether to collect shipping address
collect_tax_addressbooleanWhether to collect billing/tax address
created_atintegerCreation timestamp in Unix format
metadataobjectAdditional custom data (key-value pairs)
optionsarrayVariant option definitions (see Option below)
media_orderarrayOrdered list of media asset IDs
includesobjectIncluded media assets with signed URLs

Option Object

ParameterTypeDescription
namestringOption name (e.g., "Color", "Size")
sort_orderintegerDisplay order
valuesarrayAllowed values for this option

Option Value Object

ParameterTypeDescription
valuestringOption value label
sort_orderintegerDisplay order
metadataobjectAdditional metadata
swatchobjectVisual swatch information

Media Object

ParameterTypeDescription
idstringMedia identifier
urlstringCDN URL for the asset
content_typestringMIME type (e.g., image/jpeg)
widthintegerWidth in pixels
heightintegerHeight in pixels
alt_textstringAlternative text for accessibility

Amount Object

ParameterTypeDescription
amountnumberDecimal amount value
asset_idstringCurrency/asset identifier

Address Object (Shipping/Billing)

ParameterTypeDescription
namestringRecipient/Billing name
line1stringAddress line 1
line2stringAddress line 2 (optional)
citystringCity
statestringState/Province
postal_codestringPostal/ZIP code
countrystringCountry code (ISO 2-letter)
phonestringContact phone (optional)

Payout APIs

62. Create Payout

For detailed API reference, see: Create Payout API

FieldValue
API NameCreate Payout
API Endpoint/v1/payouts
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payouts

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
requeststringYesPayout parameters including destination, amount, and asset details

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payouts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

63. List Payouts

For detailed API reference, see: List Payouts API

FieldValue
API NameList Payouts
API Endpoint/v1/payouts/list
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payouts/list

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
pageintegerYesPage number (zero-based)
page_sizeintegerYesNumber of items per page (1-50)
external_idstringNoFilter by external ID

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payouts/list' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

64. Get Payout

For detailed API reference, see: Get Payout API

FieldValue
API NameGet Payout
API Endpoint/v1/payouts/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/payouts/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesUnique payout identifier

Example:

curl --location --request GET 'https://api.martianpay.com/v1/payouts/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

65. Preview Payout

For detailed API reference, see: Preview Payout API

FieldValue
API NamePreview Payout
API Endpoint/v1/payouts/preview
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payouts/preview

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
requeststringYesPayout parameters for preview calculation

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payouts/preview' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

Payroll APIs

66. Create Payroll

For detailed API reference, see: Create Payroll API

FieldValue
API NameCreate Payroll
API Endpoint/v1/payrolls
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payrolls

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
csv_filefileYesCSV file containing payroll items

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payrolls' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

67. Create Direct Payroll

For detailed API reference, see: Create Direct Payroll API

FieldValue
API NameCreate Direct Payroll
API Endpoint/v1/payrolls/direct
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payrolls/direct

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
requeststringYesDirect payroll creation parameters

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payrolls/direct' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

68. List Payrolls

For detailed API reference, see: List Payrolls API

FieldValue
API NameList Payrolls
API Endpoint/v1/payrolls
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/payrolls

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
pageintegerNoPage number, starting from 0
page_sizeintegerYesItems per page
start_datestringNoStart date for filtering
end_datestringNoEnd date for filtering
external_idstringNoFilter by external ID
payroll_idstringNoFilter by payroll ID
statusstringNoFilter by status (pending, approved, paid, etc.)

Example:

curl --location --request GET 'https://api.martianpay.com/v1/payrolls' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

69. Get Payroll

For detailed API reference, see: Get Payroll API

FieldValue
API NameGet Payroll
API Endpoint/v1/payrolls/{id}
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/payrolls/{id}

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesPayroll ID

Example:

curl --location --request GET 'https://api.martianpay.com/v1/payrolls/example_id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

70. Confirm Payroll

For detailed API reference, see: Confirm Payroll API

FieldValue
API NameConfirm Payroll
API Endpoint/v1/payrolls/:id/confirm
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/payrolls/:id/confirm

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesPayroll ID

Example:

curl --location --request POST 'https://api.martianpay.com/v1/payrolls/:id/confirm' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

Approval APIs

71. Get Approval Detail

For detailed API reference, see: Get Approval Detail API

FieldValue
API NameGet Approval Detail
API Endpoint/v1/approval/detail
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/approval/detail

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
resource_idstringNoResource ID
resource_typestringNoResource type
instance_idstringNoInstance ID

Example:

curl --location --request GET 'https://api.martianpay.com/v1/approval/detail' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

72. Approve

For detailed API reference, see: Approve API

FieldValue
API NameApprove
API Endpoint/v1/approval/{id}/approve
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/approval/{id}/approve

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesApproval instance ID
requeststringYesApproval details

Example:

curl --location --request POST 'https://api.martianpay.com/v1/approval/example_id/approve' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

73. Reject

For detailed API reference, see: Reject API

FieldValue
API NameReject
API Endpoint/v1/approval/{id}/reject
HTTP MethodPOST
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: POST https://api.martianpay.com/v1/approval/{id}/reject

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Request Parameters:

ParameterTypeRequiredDescription
idstringYesApproval instance ID
requeststringYesRejection details

Example:

curl --location --request POST 'https://api.martianpay.com/v1/approval/example_id/reject' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]

Balance/Stats APIs

74. Get Balance Stats

For detailed API reference, see: Get Balance Stats API

FieldValue
API NameGet Balance Stats
API Endpoint/v1/stats/balance
HTTP MethodGET
Data FormatJSON
AuthenticationBasic Auth (Username is API Key, Password is empty)
Content-Typeapplication/json

Request URL: GET https://api.martianpay.com/v1/stats/balance

Request Header Example:

Content-Type: application/json
Authorization: Basic {BASE64_ENCODE(api_key + ":")}

You can generate Basic Auth online: https://www.ol-tools.com/basic-auth-generator

Example:

curl --location --request GET 'https://api.martianpay.com/v1/stats/balance' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {BASE64_ENCODE(api_key + ":")}'

Response Example:

{
"code": 0,
"error_code": "success",
"msg": "success",
"data": {}
}

[Refer to the API documentation for complete response schema]