Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains all Requests connected with subscriptions

Hierarchy

  • BaseExtend
    • Subscription

Index

Constructors

constructor

  • new Subscription(config: ApiConfig, request: Request): Subscription
  • Parameters

    • config: ApiConfig
    • request: Request

    Returns Subscription

Properties

config

config: ApiConfig

request

request: Request

Methods

cancelSubscription

  • Cancels the customer's subscription

    method

    cancelSubscription

    async
    example
    InPlayer.Subscription
    .cancelSubscription('https://exampleurl/subscriptions/cancel/S-Lir3kiHc9-JD')
    .then(data => console.log(data));

    Parameters

    • unsubscribeUrl: string

      The unsubscribe url for the subscription to be canceled

    Returns Promise<AxiosResponse<CancelSubscription>>

    Contains the data:

    {
    code: number;
    subscription: string;
    operation: string = "unsubscribe";
    description: string;
    status: string = "pending";
    timestamp: number;
    }

changeSubscriptionPlan

  • Changes the subscription plan for a given asset.

    method

    post

    async
    example
    InPlayer.Subscription
    .changeSubscriptionPlan({
    access_fee_id: 1,
    inplayer_token: 'S-xxxxx-ST'
    }
    )
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { access_fee_id: number; inplayer_token: string }
      • access_fee_id: number
      • inplayer_token: string

    Returns Promise<AxiosResponse<ChangeSubscriptionPlanResponse>>

createSubscription

  • createSubscription(__namedParameters: { accessFee: number; brandingId?: number; cardName: string; cvv: number; expMonth: string; expYear: string; number: number; paymentMethod: number; referrer: string; returnUrl: string; voucherCode?: string }): Promise<AxiosResponse<CommonResponse>>
  • Subscribes to a given asset. Use this method ONLY if the accessFee.type === 'subscription'. Otherwise please use InPlayer.Payment.createPayment()

    method

    createSubscription

    async
    example
    InPlayer.Subscription
    .createSubscription({
    number: 1,
    cardName: 'Payoneer',
    expMonth: 11,
    expYear: 12,
    cvv: 546,
    accessFee: 13.4,
    paymentMethod: 1,
    referrer: 'http://localhost:3000',
    voucherCode: '123123125914i2erjfg',
    brandingId?: 1234,
    returnUrl?: 'https://event.inplayer.com/staging',
    }
    )
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { accessFee: number; brandingId?: number; cardName: string; cvv: number; expMonth: string; expYear: string; number: number; paymentMethod: number; referrer: string; returnUrl: string; voucherCode?: string }
      • accessFee: number
      • Optional brandingId?: number
      • cardName: string
      • cvv: number
      • expMonth: string
      • expYear: string
      • number: number
      • paymentMethod: number
      • referrer: string
      • returnUrl: string
      • Optional voucherCode?: string

    Returns Promise<AxiosResponse<CommonResponse>>

    Contains the data:

    {
    code: 202,
    message: "Submitted for payment"
    }

directDebitSubscribe

  • directDebitSubscribe(__namedParameters: { accessFeeId: number; assetId: number; brandingId?: number; referrer: string; voucherCode: string }): Promise<AxiosResponse<CommonResponse>>
  • Process a request for direct debit subscribe

    method

    directDebitSubscribe

    async
    example
    InPlayer.Subscription
    .directDebitSubscribe({ assetId, accessFeeId, voucherCode, brandingId })
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { accessFeeId: number; assetId: number; brandingId?: number; referrer: string; voucherCode: string }
      • accessFeeId: number
      • assetId: number
      • Optional brandingId?: number
      • referrer: string
      • voucherCode: string

    Returns Promise<AxiosResponse<CommonResponse>>

    Contains the data:

    {
    code: 200,
    message: "Submitted for payment"
    }

getDefaultCreditCard

  • Gets the default credit card per currency used for subscription rebills

    method

    getDefaultCreditCard

    async
    example
    InPlayer.Payment
    .getDefaultCreditCard()
    .then(data => console.log(data));

    Returns Promise<AxiosResponse<GetDefaultCard>>

    Contains the data:

    {
    cards: [{
    number: number;
    card_name: string;
    exp_month: string;
    exp_year: string;
    }];
    }

getSubscription

  • Gets subscription details for a given user by id

    method

    getSubscription

    async
    example
    InPlayer.Subscription
    .getSubscription('abcdef')
    .then(data => console.log(data));

    Parameters

    • id: string

      The subscription id.

    Returns Promise<AxiosResponse<SubscriptionDetails>>

    Contains the data:

    {
    cancel_token: string;
    status: string;
    description: string;
    asset_title: string;
    asset_id: number;
    formatted_amount: string;
    amount: number;
    currency: string;
    merchant_id: number;
    created_at: number;
    updated_at: number;
    next_billing_date: number;
    unsubscribe_url: string;
    }

getSubscriptions

  • getSubscriptions(page?: number, limit?: number, status?: string): Promise<AxiosResponse<GetSubscription>>
  • Gets all subscriptions for a given user

    method

    getSubscriptions

    async
    example
    InPlayer.Subscription
    .getSubscriptions()
    .then(data => console.log(data));

    Parameters

    • page: number = 0

      The current page number. If it is not set the starting page will be returned.

    • limit: number = 15

      The number of items per page. If it is not set the number of items per page will be 15.

    • status: string = ''

      The subscription status. It it is not set the regular active subscriptions will be returned.

    Returns Promise<AxiosResponse<GetSubscription>>

    Contains the data:

    {
    total: number;
    page: number;
    offset: number;
    limit: number;
    collection: [{
    cancel_token: string;
    status: string;
    description: string;
    asset_title: string;
    asset_id: number;
    formatted_amount: string;
    amount: number;
    currency: string;
    merchant_id: number;
    created_at: number;
    updated_at: number;
    next_billing_date: number;
    unsubscribe_url: string;
    }];
    }

idealSubscribe

  • idealSubscribe(__namedParameters: { accessFeeId: number; bank: string; brandingId?: number; referrer: string; returnUrl: string; voucherCode?: string }): Promise<AxiosResponse<CommonResponse>>
  • Process a request for start ideal subscribe

    method

    idealSubscribe

    async
    example
    InPlayer.Subscription
    .idealSubscribe({
    1243,
    'handelsbanken',
    'https://event.inplayer.com/staging',
    'http://google.com',
    143,
    '123qwerty987'
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { accessFeeId: number; bank: string; brandingId?: number; referrer: string; returnUrl: string; voucherCode?: string }
      • accessFeeId: number
      • bank: string
      • Optional brandingId?: number
      • referrer: string
      • returnUrl: string
      • Optional voucherCode?: string

    Returns Promise<AxiosResponse<CommonResponse>>

    Contains the data:

    {
    code: 200,
    message: "Submitted for payment"
    }

setDefaultCreditCard

  • setDefaultCreditCard(__namedParameters: { cardName: string; cardNumber: string; currency: string; cvc: number; expMonth: number; expYear: number }): Promise<AxiosResponse<SetDefaultCard>>
  • Sets card per currency as default card that is to be used for further subscription rebills

    method

    setDefaultCreditCard

    async
    example
    InPlayer.Payment
    .setDefaultCreditCard({
    cardNumber: '4242424242424242',
    cardName: 'John Doe',
    cvc: 123,
    expMonth: 1,
    expYear: 2020,
    currency: 'EUR'
    })
    .then(data => console.log(data));

    Parameters

    • __namedParameters: { cardName: string; cardNumber: string; currency: string; cvc: number; expMonth: number; expYear: number }
      • cardName: string
      • cardNumber: string
      • currency: string
      • cvc: number
      • expMonth: number
      • expYear: number

    Returns Promise<AxiosResponse<SetDefaultCard>>

    Contains the data:

    {
    number: number;
    card_name: string;
    exp_month: number;
    exp_year: number;
    }

Generated using TypeDoc