Developer Docs

Developer Docs

  • Getting Started
  • SubscriptionJS
  • REST API
  • Webhooks
  • Code Samples
  • UseCases
  • Request a Demo

›SubscriptionJS

SubscriptionJS

  • Overview
  • Initial Setup
  • Signup
  • Portal
  • Payments
  • Coupons
  • Synchronization
  • Going Live

Reference

    Methods

    • Payment
    • Signup
    • Portal
    • General
  • Types
  • Callbacks

Embeddable Elements

  • Available Elements
  • Payment Form IFrame

    • Introduction
    • Configuration
    • Appearance
    • Reference

Coupons

To grant a discount you can offer Coupon Codes to your customers. A single Coupon Code can be passed with each subscription or up-/downgrade order.

A Coupon Code is passed in the Cart object.

var cart = {
    "planVariantId": "527caacdeb596a247c6e0500",
    "couponCode": "ACB-123"
};

Coupon Code validation

The Cart object can be passed several SubscriptionJS methods. If the Coupon Code is invalid an error with the code InvalidCouponCode will be returned.

The Preview() method is an exception. It'll return an Order object in either case. It contains the sub object Coupon with detailed information.

Valid Code passed to Preview()

{
    "Order" : {
        "Coupon":{
            "CouponCode":"ABCDEF",
            "CouponId":"55d31a7d68a44f270478425d",
            "DiscountId":"55d31a4e68a44f2704784259"
        },
        ...
    }
}

Invalid Code passed to Preview()

{
    "Order" : {
        "Coupon":{
            "CouponCode":"ABCDEF",
            "ErrorMessage":"CouponCode is invalid",
            "ErrorCode":"InvalidCouponCode"
        },
        ...
    }
}

Coupon Codes are normalized to uppercase alphanumeric values before beeing validated. This means that a customer might enter 'ABc*12-3' which will be normalized to 'ABC123'. The same is done with the codes specified in the billwerk Admin UI. This means a specified code 'AB-C1-23' will match the customer's code 'ABc*12-3'.

Last updated on 3/20/2020 by Thomas Tauber
← PaymentsSynchronization →
  • Coupon Code validation
Docs
Getting StartedAPI Reference
Resource
Help CenterSupportBlogTutorials
Start with billwerk
Test for free
Request a Demo
Already started?
billwerk Sandboxbillwerk Production
billwerk GmbH
© Made with ❤ in Germany for Europe by billwerk GmbH | 2022
Imprint
|
Data Privacy Rules
|
Disclaimer