blinkSDK.getSubscription()
Get a user's valid subscription if the user is authenticated and has a valid subscription.
Usage
const mySubscription = blinkSDK.getSubscription();
if (mySubscription != null) {
console.log("Blink user has a valid subscription since" + subscription.createdAt);
}
Signature
blinkSDK.getSubscription()
Parameters
none
Returns
In case of success, it will return a subscription object, or null if the user doesn't have a valid
subscription.
Objects definitions
Subscription
{
"id" : // subscription id
"deliveryAddressId" : // id of the user's address to deliver the print version of the newspaper/magazine
"blinkSignature" : // Blink's proof that the user is subscribed
"userId" : // Blink user id
"amount" : // amount paid for each cycle, expressed in currency units
"createdAt" : // subscription create date
"canceledAt" : // date when the user has cancelled the subscription
"nextPaymentAttempt" : // date for the next payment
"currencyCode" : // currency ISO 4217 code (i.e. USD/GBP/EUR)
"offerId" : // id of the subscription offer created by the merchant
}
| name | type | description |
|---|---|---|
id | String | subscription id |
deliveryAddressId | String(can be null) | id of the user's address to deliver the print version of the newspaper/magazine |
blinkSignature | hex String(can be null) | Blink's proof that the user is subscribed |
userId | String | Blink user id |
amount | Number | amount paid for each cycle, expressed in currency units |
createdAt | iso date String | subscription create date |
canceledAt | iso date String (can e null) | date when the user has cancelled the subscription |
nextPaymentAttempt | iso date String | date for the next payment |
currencyCode | String(can be null) | currency ISO 4217 code (i.e. USD/GBP/EUR) |
offerId | String | id of the subscription offer created by the merchant |