Skip to main content
POST
/
merchant
/
subscription
/
payment
/
new
New Subscription Payment
curl --request POST \
  --url https://api.unibee.dev/merchant/subscription/payment/new \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "gatewayId": 123,
  "cancelUrl": "<string>",
  "countryCode": "<string>",
  "currency": "<string>",
  "description": "<string>",
  "email": "<string>",
  "externalPaymentId": "<string>",
  "externalUserId": "<string>",
  "gasPayer": "<string>",
  "items": [
    {
      "amount": 123,
      "amountExcludingTax": 123,
      "currency": "<string>",
      "description": "<string>",
      "name": "<string>",
      "quantity": 123,
      "tax": 123,
      "taxPercentage": 123,
      "unitAmountExcludingTax": 123
    }
  ],
  "metadata": {},
  "name": "<string>",
  "planId": 123,
  "redirectUrl": "<string>",
  "totalAmount": 123,
  "userId": 123
}
'
{
  "code": 123,
  "data": {
    "action": {},
    "externalPaymentId": "<string>",
    "link": "<string>",
    "paymentId": "<string>",
    "status": 123
  },
  "merchantId": 123,
  "message": "<string>",
  "redirect": "<string>",
  "requestId": "<string>"
}

Endpoint Overview

POST https://api.unibee.dev/merchant/subscription/payment/new New Subscription Payment

Authorization

All UniBee Merchant API requests require authentication via API key.
HeaderRequiredDescription
AuthorizationYesBearer <your_api_key>
Content-TypeYesapplication/json (for request body)

Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

Request body

NameTypeRequiredDescription
cancelUrlstringNoCancelUrl
countryCodestringNoCountryCode
currencystringNoCurrency, either Currency&TotalAmount or PlanId needed
descriptionstringNoDescription
emailstringNoEmail, either ExternalUserId&Email or UserId needed
externalPaymentIdstringNoExternalPaymentId should unique for payment
externalUserIdstringNoExternalUserId, unique, either ExternalUserId&Email or UserId needed
gasPayerstringNowho pay the gas, merchant|user
gatewayIdintegerYesGatewayId
itemsarrayNoItems
metadataobjectNoMetadata,Map
namestringNoName
planIdintegerNoPlanId, either TotalAmount&Currency or PlanId needed
redirectUrlstringNoRedirect Url
totalAmountintegerNoTotal PaymentAmount, Cent, either TotalAmount&Currency or PlanId needed
userIdintegerNoUserId, either ExternalUserId&Email or UserId needed

Request examples

cURL

curl -X POST "https://api.unibee.dev/merchant/subscription/payment/new" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "cancelUrl": "https://example.com",
  "countryCode": "",
  "currency": "",
  "description": "",
  "email": "user@example.com",
  "externalPaymentId": "id_example",
  "externalUserId": "id_example",
  "gasPayer": "",
  "gatewayId": 0,
  "items": [],
  "metadata": {},
  "name": "",
  "planId": 0,
  "redirectUrl": "https://example.com",
  "totalAmount": 0,
  "userId": 0
}'

Sandbox

curl -X POST "https://api-sandbox.unibee.top/merchant/subscription/payment/new" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "cancelUrl": "https://example.com",
  "countryCode": "",
  "currency": "",
  "description": "",
  "email": "user@example.com",
  "externalPaymentId": "id_example",
  "externalUserId": "id_example",
  "gasPayer": "",
  "gatewayId": 0,
  "items": [],
  "metadata": {},
  "name": "",
  "planId": 0,
  "redirectUrl": "https://example.com",
  "totalAmount": 0,
  "userId": 0
}'

Response

Success responses return a JSON envelope with code, data, message, redirect, and requestId. code 0 indicates success.
FieldTypeDescription
codeintegerResponse code. 0 = success
dataobjectResponse payload
data.actionobject
data.externalPaymentIdstringThe external unique id of payment
data.linkstring
data.paymentIdstringThe unique id of payment
data.statusintegerStatus, 10-Created|20-Success|30-Failed|40-Cancelled
messagestringHuman-readable message
requestIdstringRequest ID for support

Error handling

HTTP statusMeaning
400Bad request — invalid or missing parameters. Check message in the body.
401Unauthorized — missing or invalid API key.
404Not found — invalid path or resource.
500Server error — retry with backoff.
When code in the response body is non-zero, check message for details. Use requestId when contacting support.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
gatewayId
integer<int64>
required

GatewayId

cancelUrl
string<string>

CancelUrl

countryCode
string<string>

CountryCode

currency
string<string>

Currency, either Currency&TotalAmount or PlanId needed

description
string<string>

Description

email
string<string>

Email, either ExternalUserId&Email or UserId needed

externalPaymentId
string<string>

ExternalPaymentId should unique for payment

externalUserId
string<string>

ExternalUserId, unique, either ExternalUserId&Email or UserId needed

gasPayer
string<string>

who pay the gas, merchant|user

items
object[]

Items

metadata
object

Metadata,Map

name
string<string>

Name

planId
integer<int64>

PlanId, either TotalAmount&Currency or PlanId needed

redirectUrl
string<string>

Redirect Url

totalAmount
integer<int64>

Total PaymentAmount, Cent, either TotalAmount&Currency or PlanId needed

userId
integer<int64>

UserId, either ExternalUserId&Email or UserId needed

Response

200 - application/json
code
integer<int>
data
object
merchantId
integer<int64>
message
string<string>
redirect
string<string>
requestId
string<string>