Skip to main content
Version: Lastest

API Update plan

Endpoint: /api/v1/subs/plans/{planId}

Method: PATCH

Header Params

ParamRequiredTypeDescriptionNote
X-APPOTAPAY-AUTHrequiredString How to generate JWT_TOKEN
Content-TyperequiredStringValue: application/json
X-Request-IDoptionalStringUUIDv4 format. Request ID to check when a problem occursmax:42
LanguageoptionalStringThe value vi or en corresponding to the payment link will be Vietnamese or English, (default: vi)

in:vi,en

X-Account-Ref-IDoptionalString

Iidentifier of the sub account provided by AppotaPay.

Mandatory be passed over when processing payment for transactions of owner-type sub account

{
"X-APPOTAPAY-AUTH": "JWT_TOKEN",
"Content-Type": "application/json",
"X-Request-ID": "Your_Unique_id",
"Language": "vi",
"X-Account-Ref-ID": "9723f73b-9295-4acb-884b-ab6310c2e653"
}

Request params

ParamRequiredTypeDescriptionNote
customerIdOptionalStringCustomer IDmin:1, max: 50
currencyOptionalStringCurrency unitin: VND
amountOptionalIntegerAmountmin: 5000, max: 100000000
paymentMethodsOptionalArrayPayment method list
paymentMethods.*.paymentMethodIdOptionalStringPayment method ID
paymentMethods.*.rankOptionalIntegerIndicate the order which payments methods will be attempted for a payment cycle instance. Available values - 1 to 5min: 1
currencyExchangeOptionalObject
currencyExchange.amountOptionalNumber

Exchange amount

Supports 2 decimals, eg: 12.02

min: 0.10, max: 9999999999
currencyExchange.currencyOptionalString

Currency unit

Support: USD

Example Request

{
"customerId": "01HRVK3A0G66QJB16W2R1G2HSJ",
"currency": "VND",
"amount": 405100,
"paymentMethods": [
{
"paymentMethodId": "f19bbadb-3446-4558-84c2-3c36a6b9757a",
"rank": 1
}
]
}

Response data

Success

Http Status Code 200 - OK

Success responses will contain a single Plan object

Failure

HTTP Status Code != 200

Error response params

ParamRequiredTypeDescription
errorCoderequiredIntegerError code
messagerequiredStringError message
errorsoptionalArrayDetailed error description
errors.*.fieldoptionalStringField data is corrupted
errors.*.reasonoptionalStringDescription of the data field in error
{
"errorCode": 3005,
"message": "Plan not exist"
}

Common error code table

Full error code, please check this error code list

Error codeDescription
0Success
1Missing or Invalid Params
11Partner is not found
13Partner has been blocked
14API Key is invalid
15API Key is not activated or blocked
92IP is not allowed to access
99Undefined error, please contact AppotaPay for more detailed information
401Unauthorized
500Server error
3003Customer not exist
3004Payment method not exist
3005Plan not exist
3006Plan was inactive before
3012Payment method is invalid
3046The plan is pending, please check it later