Skip to main content
POST
/
merchant
/
subscription
/
new_onetime_addon_payment
New Subscription Onetime Addon Payment
curl --request POST \
  --url https://api.unibee.dev/merchant/subscription/new_onetime_addon_payment \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "addonId": 123,
  "quantity": 123,
  "applyPromoCredit": true,
  "applyPromoCreditAmount": 123,
  "cancelUrl": "<string>",
  "currency": "<string>",
  "discountAmount": 123,
  "discountCode": "<string>",
  "discountPercentage": 123,
  "gatewayId": 123,
  "gatewayPaymentType": "<string>",
  "metadata": {},
  "returnUrl": "<string>",
  "subscriptionId": "<string>",
  "taxPercentage": 123,
  "userId": 123
}
'
{
  "code": 123,
  "data": {
    "invoice": {
      "PaymentMethodId": "<string>",
      "autoCharge": true,
      "billingCycleAnchor": 123,
      "bizType": 123,
      "countryCode": "<string>",
      "createFrom": "<string>",
      "creditAccount": {
        "amount": 123,
        "createTime": 123,
        "currency": "<string>",
        "currencyAmount": 123,
        "exchangeRate": 123,
        "id": 123,
        "payoutEnable": 123,
        "rechargeEnable": 123,
        "totalDecrementAmount": 123,
        "totalIncrementAmount": 123,
        "type": 123,
        "userId": 123
      },
      "creditPayout": {
        "creditAmount": 123,
        "currencyAmount": 123,
        "exchangeRate": 123
      },
      "cryptoAmount": 123,
      "cryptoCurrency": "<string>",
      "currency": "<string>",
      "data": "<string>",
      "dayUtilDue": 123,
      "discount": {
        "advance": true,
        "billingType": 123,
        "code": "<string>",
        "createTime": 123,
        "currency": "<string>",
        "cycleLimit": 123,
        "discountAmount": 123,
        "discountPercentage": 123,
        "discountType": 123,
        "endTime": 123,
        "id": 123,
        "isDeleted": 123,
        "merchantId": 123,
        "metadata": {},
        "name": "<string>",
        "planApplyGroup": {
          "currency": [
            "<string>"
          ],
          "groupPlanIntervalSelector": [
            {
              "intervalCount": 123,
              "intervalUnit": "<string>"
            }
          ],
          "type": [
            123
          ]
        },
        "planApplyType": 123,
        "planIds": [
          123
        ],
        "quantity": 123,
        "startTime": 123,
        "status": 123,
        "upgradeLongerOnly": true,
        "upgradeOnly": true,
        "userLimit": 123,
        "userScope": 123
      },
      "discountAmount": 123,
      "discountCode": "<string>",
      "finishTime": 123,
      "gatewayId": 123,
      "id": 123,
      "invoiceId": "<string>",
      "invoiceName": "<string>",
      "lines": [
        {
          "amount": 123,
          "amountExcludingTax": 123,
          "currency": "<string>",
          "description": "<string>",
          "discountAmount": 123,
          "discountCode": "<string>",
          "fromAddress": {
            "address": "<string>",
            "city": "<string>",
            "countryCode": "<string>",
            "state": "<string>",
            "verified": true,
            "zipCode": "<string>"
          },
          "lineId": "<string>",
          "metricCharge": {
            "metricId": 123,
            "CurrentUsedValue": 123,
            "chargePricing": {
              "chargeType": 123,
              "graduatedAmounts": [
                {
                  "endValue": 123,
                  "flatAmount": 123,
                  "perAmount": 123,
                  "startValue": 123
                }
              ],
              "metricId": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            },
            "description": "<string>",
            "lines": [
              {
                "amount": 123,
                "flatAmount": 123,
                "quantity": 123,
                "step": "<string>",
                "unitAmount": 123
              }
            ],
            "maxEventId": 123,
            "minEventId": 123,
            "name": "<string>",
            "totalChargeAmount": 123
          },
          "name": "<string>",
          "nexusAddresses": [
            {
              "address": "<string>",
              "city": "<string>",
              "countryCode": "<string>",
              "state": "<string>",
              "verified": true,
              "zipCode": "<string>"
            }
          ],
          "originAmount": 123,
          "originUnitAmountExcludeTax": 123,
          "pdfDescription": "<string>",
          "periodEnd": 123,
          "periodStart": 123,
          "plan": {
            "amount": 123,
            "bindingAddonIds": "<string>",
            "bindingOnetimeAddonIds": "<string>",
            "cancelAtTrialEnd": 123,
            "checkoutUrl": "<string>",
            "createTime": 123,
            "currency": "<string>",
            "description": "<string>",
            "disableAutoCharge": 123,
            "externalPlanId": "<string>",
            "extraMetricData": "<string>",
            "gasPayer": "<string>",
            "homeUrl": "<string>",
            "id": 123,
            "imageUrl": "<string>",
            "internalName": "<string>",
            "intervalCount": 123,
            "intervalUnit": "<string>",
            "merchantId": 123,
            "metadata": {},
            "metricLimits": [
              {
                "metricId": 123,
                "metricLimit": 123
              }
            ],
            "metricMeteredCharge": [
              {
                "chargeType": 123,
                "graduatedAmounts": [
                  {
                    "endValue": 123,
                    "flatAmount": 123,
                    "perAmount": 123,
                    "startValue": 123
                  }
                ],
                "metricId": 123,
                "standardAmount": 123,
                "standardStartValue": 123
              }
            ],
            "metricRecurringCharge": [
              {
                "chargeType": 123,
                "graduatedAmounts": [
                  {
                    "endValue": 123,
                    "flatAmount": 123,
                    "perAmount": 123,
                    "startValue": 123
                  }
                ],
                "metricId": 123,
                "standardAmount": 123,
                "standardStartValue": 123
              }
            ],
            "multiCurrencies": [
              {
                "amount": 123,
                "autoExchange": true,
                "currency": "<string>",
                "disable": true,
                "exchangeRate": 123
              }
            ],
            "planName": "<string>",
            "productId": 123,
            "publishStatus": 123,
            "status": 123,
            "taxPercentage": 123,
            "trialAmount": 123,
            "trialDemand": "<string>",
            "trialDurationTime": 123,
            "type": 123,
            "usVATConfig": {
              "active": true,
              "fromAddress": {
                "address": "<string>",
                "city": "<string>",
                "countryCode": "<string>",
                "state": "<string>",
                "verified": true,
                "zipCode": "<string>"
              },
              "nexusAddresses": [
                {
                  "address": "<string>",
                  "city": "<string>",
                  "countryCode": "<string>",
                  "state": "<string>",
                  "verified": true,
                  "zipCode": "<string>"
                }
              ],
              "sellOnUSOnly": true,
              "taxCode": "<string>",
              "toAddress": {
                "address": "<string>",
                "city": "<string>",
                "countryCode": "<string>",
                "state": "<string>",
                "verified": true,
                "zipCode": "<string>"
              }
            }
          },
          "planMetricChargeConfigs": [
            {
              "chargeType": 123,
              "metricCode": "<string>",
              "metricId": 123,
              "metricName": "<string>",
              "metricType": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            }
          ],
          "planMetricLimitConfigs": [
            {
              "metricCode": "<string>",
              "metricId": 123,
              "metricLimit": 123,
              "metricName": "<string>",
              "metricType": 123
            }
          ],
          "proration": true,
          "prorationDate": 123,
          "prorationScale": 123,
          "quantity": 123,
          "tax": 123,
          "taxCode": "<string>",
          "taxPercentage": 123,
          "toAddress": {
            "address": "<string>",
            "city": "<string>",
            "countryCode": "<string>",
            "state": "<string>",
            "verified": true,
            "zipCode": "<string>"
          },
          "unitAmountExcludingTax": 123,
          "ustaxAlert": "<string>"
        }
      ],
      "link": "<string>",
      "metadata": {},
      "originAmount": 123,
      "partialCreditPaidAmount": 123,
      "paymentId": "<string>",
      "paymentLink": "<string>",
      "paymentType": "<string>",
      "periodEnd": 123,
      "periodStart": 123,
      "planSnapshot": {
        "addons": [
          {
            "addonPlan": {
              "amount": 123,
              "bindingAddonIds": "<string>",
              "bindingOnetimeAddonIds": "<string>",
              "cancelAtTrialEnd": 123,
              "checkoutUrl": "<string>",
              "createTime": 123,
              "currency": "<string>",
              "description": "<string>",
              "disableAutoCharge": 123,
              "externalPlanId": "<string>",
              "extraMetricData": "<string>",
              "gasPayer": "<string>",
              "homeUrl": "<string>",
              "id": 123,
              "imageUrl": "<string>",
              "internalName": "<string>",
              "intervalCount": 123,
              "intervalUnit": "<string>",
              "merchantId": 123,
              "metadata": {},
              "metricLimits": [
                {
                  "metricId": 123,
                  "metricLimit": 123
                }
              ],
              "metricMeteredCharge": [
                {
                  "chargeType": 123,
                  "graduatedAmounts": [
                    {
                      "endValue": 123,
                      "flatAmount": 123,
                      "perAmount": 123,
                      "startValue": 123
                    }
                  ],
                  "metricId": 123,
                  "standardAmount": 123,
                  "standardStartValue": 123
                }
              ],
              "metricRecurringCharge": [
                {
                  "chargeType": 123,
                  "graduatedAmounts": [
                    {
                      "endValue": 123,
                      "flatAmount": 123,
                      "perAmount": 123,
                      "startValue": 123
                    }
                  ],
                  "metricId": 123,
                  "standardAmount": 123,
                  "standardStartValue": 123
                }
              ],
              "multiCurrencies": [
                {
                  "amount": 123,
                  "autoExchange": true,
                  "currency": "<string>",
                  "disable": true,
                  "exchangeRate": 123
                }
              ],
              "planName": "<string>",
              "productId": 123,
              "publishStatus": 123,
              "status": 123,
              "taxPercentage": 123,
              "trialAmount": 123,
              "trialDemand": "<string>",
              "trialDurationTime": 123,
              "type": 123,
              "usVATConfig": {
                "active": true,
                "fromAddress": {
                  "address": "<string>",
                  "city": "<string>",
                  "countryCode": "<string>",
                  "state": "<string>",
                  "verified": true,
                  "zipCode": "<string>"
                },
                "nexusAddresses": [
                  {
                    "address": "<string>",
                    "city": "<string>",
                    "countryCode": "<string>",
                    "state": "<string>",
                    "verified": true,
                    "zipCode": "<string>"
                  }
                ],
                "sellOnUSOnly": true,
                "taxCode": "<string>",
                "toAddress": {
                  "address": "<string>",
                  "city": "<string>",
                  "countryCode": "<string>",
                  "state": "<string>",
                  "verified": true,
                  "zipCode": "<string>"
                }
              }
            },
            "quantity": 123
          }
        ],
        "autoCharge": true,
        "chargeType": 123,
        "plan": {
          "amount": 123,
          "bindingAddonIds": "<string>",
          "bindingOnetimeAddonIds": "<string>",
          "cancelAtTrialEnd": 123,
          "checkoutUrl": "<string>",
          "createTime": 123,
          "currency": "<string>",
          "description": "<string>",
          "disableAutoCharge": 123,
          "externalPlanId": "<string>",
          "extraMetricData": "<string>",
          "gasPayer": "<string>",
          "homeUrl": "<string>",
          "id": 123,
          "imageUrl": "<string>",
          "internalName": "<string>",
          "intervalCount": 123,
          "intervalUnit": "<string>",
          "merchantId": 123,
          "metadata": {},
          "metricLimits": [
            {
              "metricId": 123,
              "metricLimit": 123
            }
          ],
          "metricMeteredCharge": [
            {
              "chargeType": 123,
              "graduatedAmounts": [
                {
                  "endValue": 123,
                  "flatAmount": 123,
                  "perAmount": 123,
                  "startValue": 123
                }
              ],
              "metricId": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            }
          ],
          "metricRecurringCharge": [
            {
              "chargeType": 123,
              "graduatedAmounts": [
                {
                  "endValue": 123,
                  "flatAmount": 123,
                  "perAmount": 123,
                  "startValue": 123
                }
              ],
              "metricId": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            }
          ],
          "multiCurrencies": [
            {
              "amount": 123,
              "autoExchange": true,
              "currency": "<string>",
              "disable": true,
              "exchangeRate": 123
            }
          ],
          "planName": "<string>",
          "productId": 123,
          "publishStatus": 123,
          "status": 123,
          "taxPercentage": 123,
          "trialAmount": 123,
          "trialDemand": "<string>",
          "trialDurationTime": 123,
          "type": 123,
          "usVATConfig": {
            "active": true,
            "fromAddress": {
              "address": "<string>",
              "city": "<string>",
              "countryCode": "<string>",
              "state": "<string>",
              "verified": true,
              "zipCode": "<string>"
            },
            "nexusAddresses": [
              {
                "address": "<string>",
                "city": "<string>",
                "countryCode": "<string>",
                "state": "<string>",
                "verified": true,
                "zipCode": "<string>"
              }
            ],
            "sellOnUSOnly": true,
            "taxCode": "<string>",
            "toAddress": {
              "address": "<string>",
              "city": "<string>",
              "countryCode": "<string>",
              "state": "<string>",
              "verified": true,
              "zipCode": "<string>"
            }
          }
        },
        "previousAddons": [
          {
            "addonPlan": {
              "amount": 123,
              "bindingAddonIds": "<string>",
              "bindingOnetimeAddonIds": "<string>",
              "cancelAtTrialEnd": 123,
              "checkoutUrl": "<string>",
              "createTime": 123,
              "currency": "<string>",
              "description": "<string>",
              "disableAutoCharge": 123,
              "externalPlanId": "<string>",
              "extraMetricData": "<string>",
              "gasPayer": "<string>",
              "homeUrl": "<string>",
              "id": 123,
              "imageUrl": "<string>",
              "internalName": "<string>",
              "intervalCount": 123,
              "intervalUnit": "<string>",
              "merchantId": 123,
              "metadata": {},
              "metricLimits": [
                {
                  "metricId": 123,
                  "metricLimit": 123
                }
              ],
              "metricMeteredCharge": [
                {
                  "chargeType": 123,
                  "graduatedAmounts": [
                    {
                      "endValue": 123,
                      "flatAmount": 123,
                      "perAmount": 123,
                      "startValue": 123
                    }
                  ],
                  "metricId": 123,
                  "standardAmount": 123,
                  "standardStartValue": 123
                }
              ],
              "metricRecurringCharge": [
                {
                  "chargeType": 123,
                  "graduatedAmounts": [
                    {
                      "endValue": 123,
                      "flatAmount": 123,
                      "perAmount": 123,
                      "startValue": 123
                    }
                  ],
                  "metricId": 123,
                  "standardAmount": 123,
                  "standardStartValue": 123
                }
              ],
              "multiCurrencies": [
                {
                  "amount": 123,
                  "autoExchange": true,
                  "currency": "<string>",
                  "disable": true,
                  "exchangeRate": 123
                }
              ],
              "planName": "<string>",
              "productId": 123,
              "publishStatus": 123,
              "status": 123,
              "taxPercentage": 123,
              "trialAmount": 123,
              "trialDemand": "<string>",
              "trialDurationTime": 123,
              "type": 123,
              "usVATConfig": {
                "active": true,
                "fromAddress": {
                  "address": "<string>",
                  "city": "<string>",
                  "countryCode": "<string>",
                  "state": "<string>",
                  "verified": true,
                  "zipCode": "<string>"
                },
                "nexusAddresses": [
                  {
                    "address": "<string>",
                    "city": "<string>",
                    "countryCode": "<string>",
                    "state": "<string>",
                    "verified": true,
                    "zipCode": "<string>"
                  }
                ],
                "sellOnUSOnly": true,
                "taxCode": "<string>",
                "toAddress": {
                  "address": "<string>",
                  "city": "<string>",
                  "countryCode": "<string>",
                  "state": "<string>",
                  "verified": true,
                  "zipCode": "<string>"
                }
              }
            },
            "quantity": 123
          }
        ],
        "previousPlan": {
          "amount": 123,
          "bindingAddonIds": "<string>",
          "bindingOnetimeAddonIds": "<string>",
          "cancelAtTrialEnd": 123,
          "checkoutUrl": "<string>",
          "createTime": 123,
          "currency": "<string>",
          "description": "<string>",
          "disableAutoCharge": 123,
          "externalPlanId": "<string>",
          "extraMetricData": "<string>",
          "gasPayer": "<string>",
          "homeUrl": "<string>",
          "id": 123,
          "imageUrl": "<string>",
          "internalName": "<string>",
          "intervalCount": 123,
          "intervalUnit": "<string>",
          "merchantId": 123,
          "metadata": {},
          "metricLimits": [
            {
              "metricId": 123,
              "metricLimit": 123
            }
          ],
          "metricMeteredCharge": [
            {
              "chargeType": 123,
              "graduatedAmounts": [
                {
                  "endValue": 123,
                  "flatAmount": 123,
                  "perAmount": 123,
                  "startValue": 123
                }
              ],
              "metricId": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            }
          ],
          "metricRecurringCharge": [
            {
              "chargeType": 123,
              "graduatedAmounts": [
                {
                  "endValue": 123,
                  "flatAmount": 123,
                  "perAmount": 123,
                  "startValue": 123
                }
              ],
              "metricId": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            }
          ],
          "multiCurrencies": [
            {
              "amount": 123,
              "autoExchange": true,
              "currency": "<string>",
              "disable": true,
              "exchangeRate": 123
            }
          ],
          "planName": "<string>",
          "productId": 123,
          "publishStatus": 123,
          "status": 123,
          "taxPercentage": 123,
          "trialAmount": 123,
          "trialDemand": "<string>",
          "trialDurationTime": 123,
          "type": 123,
          "usVATConfig": {
            "active": true,
            "fromAddress": {
              "address": "<string>",
              "city": "<string>",
              "countryCode": "<string>",
              "state": "<string>",
              "verified": true,
              "zipCode": "<string>"
            },
            "nexusAddresses": [
              {
                "address": "<string>",
                "city": "<string>",
                "countryCode": "<string>",
                "state": "<string>",
                "verified": true,
                "zipCode": "<string>"
              }
            ],
            "sellOnUSOnly": true,
            "taxCode": "<string>",
            "toAddress": {
              "address": "<string>",
              "city": "<string>",
              "countryCode": "<string>",
              "state": "<string>",
              "verified": true,
              "zipCode": "<string>"
            }
          }
        }
      },
      "productName": "<string>",
      "promoCreditAccount": {
        "amount": 123,
        "createTime": 123,
        "currency": "<string>",
        "currencyAmount": 123,
        "exchangeRate": 123,
        "id": 123,
        "payoutEnable": 123,
        "rechargeEnable": 123,
        "totalDecrementAmount": 123,
        "totalIncrementAmount": 123,
        "type": 123,
        "userId": 123
      },
      "promoCreditDiscountAmount": 123,
      "promoCreditPayout": {
        "creditAmount": 123,
        "currencyAmount": 123,
        "exchangeRate": 123
      },
      "promoCreditTransaction": {
        "accountType": 123,
        "bizId": "<string>",
        "by": "<string>",
        "createTime": 123,
        "creditAmountAfter": 123,
        "creditAmountBefore": 123,
        "creditId": 123,
        "currency": "<string>",
        "deltaAmount": 123,
        "deltaCurrencyAmount": 123,
        "description": "<string>",
        "exchangeRate": 123,
        "id": 123,
        "invoiceId": "<string>",
        "merchantId": 123,
        "name": "<string>",
        "transactionId": "<string>",
        "transactionType": 123,
        "userId": 123
      },
      "prorationDate": 123,
      "prorationScale": 123,
      "refundId": "<string>",
      "sendNote": "<string>",
      "sendStatus": 123,
      "status": 123,
      "subscriptionAmount": 123,
      "subscriptionAmountExcludingTax": 123,
      "subscriptionId": "<string>",
      "taxAmount": 123,
      "taxPercentage": 123,
      "totalAmount": 123,
      "totalAmountExcludingTax": 123,
      "trialEnd": 123,
      "userId": 123,
      "userMetricChargeForInvoice": {
        "meteredChargeStats": [
          {
            "metricId": 123,
            "CurrentUsedValue": 123,
            "chargePricing": {
              "chargeType": 123,
              "graduatedAmounts": [
                {
                  "endValue": 123,
                  "flatAmount": 123,
                  "perAmount": 123,
                  "startValue": 123
                }
              ],
              "metricId": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            },
            "description": "<string>",
            "lines": [
              {
                "amount": 123,
                "flatAmount": 123,
                "quantity": 123,
                "step": "<string>",
                "unitAmount": 123
              }
            ],
            "maxEventId": 123,
            "minEventId": 123,
            "name": "<string>",
            "totalChargeAmount": 123
          }
        ],
        "recurringChargeStats": [
          {
            "metricId": 123,
            "CurrentUsedValue": 123,
            "chargePricing": {
              "chargeType": 123,
              "graduatedAmounts": [
                {
                  "endValue": 123,
                  "flatAmount": 123,
                  "perAmount": 123,
                  "startValue": 123
                }
              ],
              "metricId": 123,
              "standardAmount": 123,
              "standardStartValue": 123
            },
            "description": "<string>",
            "lines": [
              {
                "amount": 123,
                "flatAmount": 123,
                "quantity": 123,
                "step": "<string>",
                "unitAmount": 123
              }
            ],
            "maxEventId": 123,
            "minEventId": 123,
            "name": "<string>",
            "totalChargeAmount": 123
          }
        ]
      },
      "vatNumber": "<string>"
    },
    "link": "<string>",
    "paid": true,
    "subscriptionOnetimeAddon": {
      "addonId": 123,
      "createTime": 123,
      "id": 123,
      "invoiceId": "<string>",
      "isDeleted": 123,
      "metadata": {},
      "paymentId": "<string>",
      "paymentLink": "<string>",
      "quantity": 123,
      "status": 123,
      "subscriptionId": "<string>"
    }
  },
  "merchantId": 123,
  "message": "<string>",
  "redirect": "<string>",
  "requestId": "<string>"
}

Endpoint Overview

POST https://api.unibee.dev/merchant/subscription/new_onetime_addon_payment Create payment for subscription onetime addon purchase

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
addonIdintegerYesAddonId, id of one-time addon, the new payment will created base on the addon’s amount’
applyPromoCreditbooleanNoapply promo credit or not
applyPromoCreditAmountintegerNoapply promo credit amount, auto compute if not specified
cancelUrlstringNoCancelUrl, back to cancelUrl if user cancel the payment
currencystringNoThe currency of payment
discountAmountintegerNoAmount of discount
discountCodestringNoDiscountCode
discountPercentageintegerNoPercentage of discount, 100=1%, ignore if discountAmount specified
gatewayIdintegerNoGatewayId, use user’s gateway if not provide
gatewayPaymentTypestringNoGateway Payment Type
metadataobjectNoMetadata,custom data
quantityintegerYesQuantity, quantity of the new payment which one-time addon purchased
returnUrlstringNoReturnUrl, the addon’s payment will redirect based on the returnUrl provided when it’s back from gateway side
subscriptionIdstringNoSubscriptionId, id of subscription which addon will attached, either SubscriptionId or UserId needed, The only one active subscription of userId will attach the addon
taxPercentageintegerNoTaxPercentage,1000 = 10%, default user’s taxPercentage if not specified
userIdintegerNoUserId, either SubscriptionId or UserId needed, The only one active subscription will update if userId provide instead of subscriptionId

Request examples

cURL

curl -X POST "https://api.unibee.dev/merchant/subscription/new_onetime_addon_payment" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "addonId": 0,
  "applyPromoCredit": false,
  "applyPromoCreditAmount": 0,
  "cancelUrl": "https://example.com",
  "currency": "",
  "discountAmount": 0,
  "discountCode": "",
  "discountPercentage": 0,
  "gatewayId": 0,
  "gatewayPaymentType": "",
  "metadata": {},
  "quantity": 0,
  "returnUrl": "https://example.com",
  "subscriptionId": "id_example",
  "taxPercentage": 0,
  "userId": 0
}'

Sandbox

curl -X POST "https://api-sandbox.unibee.top/merchant/subscription/new_onetime_addon_payment" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "addonId": 0,
  "applyPromoCredit": false,
  "applyPromoCreditAmount": 0,
  "cancelUrl": "https://example.com",
  "currency": "",
  "discountAmount": 0,
  "discountCode": "",
  "discountPercentage": 0,
  "gatewayId": 0,
  "gatewayPaymentType": "",
  "metadata": {},
  "quantity": 0,
  "returnUrl": "https://example.com",
  "subscriptionId": "id_example",
  "taxPercentage": 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.invoiceobject
data.linkstringif automatic payment is false, Gateway Link will provided that manual payment needed
data.paidbooleantrue|false,automatic payment is default behavior for one-time addon purchased, payment will create attach to the purchase, when payment is success, return false, otherwise false
data.subscriptionOnetimeAddonobject
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

Create payment for subscription onetime addon purchase

addonId
integer<int64>
required

AddonId, id of one-time addon, the new payment will created base on the addon's amount'

quantity
integer<int64>
required

Quantity, quantity of the new payment which one-time addon purchased

applyPromoCredit
boolean<*bool>

apply promo credit or not

applyPromoCreditAmount
integer<*int64>

apply promo credit amount, auto compute if not specified

cancelUrl
string<string>

CancelUrl, back to cancelUrl if user cancel the payment

currency
string<string>

The currency of payment

discountAmount
integer<*int64>

Amount of discount

discountCode
string<string>

DiscountCode

discountPercentage
integer<*int64>

Percentage of discount, 100=1%, ignore if discountAmount specified

gatewayId
integer<*int64>

GatewayId, use user's gateway if not provide

gatewayPaymentType
string<string>

Gateway Payment Type

metadata
object

Metadata,custom data

returnUrl
string<string>

ReturnUrl, the addon's payment will redirect based on the returnUrl provided when it's back from gateway side

subscriptionId
string<string>

SubscriptionId, id of subscription which addon will attached, either SubscriptionId or UserId needed, The only one active subscription of userId will attach the addon

taxPercentage
integer<*int64>

TaxPercentage,1000 = 10%, default user's taxPercentage if not specified

userId
integer<int64>

UserId, either SubscriptionId or UserId needed, The only one active subscription will update if userId provide instead of subscriptionId

Response

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