- Use Case Number: 2-2-02
- Completed By: Software Developer
- Estimated Completion Time: 1 day
Basic Scenario
A new subscriber purchases a Subscription at the standard rate using a credit card for payment. The Subscription does not include a free trial period.Design Approach
To allow subscribers to securely enter credit card information into Subscribe, you must use Subscribe Payment Method Tokenization (PMT). For more information about using PMT, please refer to Payment Method Tokenization in the Subscribe Programming Guide. As shown in the following diagram, after the Credit Card Payment method is active in Subscribe, your storefront can reference the card and Account IDs when creating the Subscription. This attaches the new payment method to the subscriber’s Account and Subscription in Subscribe.
Initiate Payment Method Tokenization Using Subscribe APIs
- Set up an account with your payment processor of choice.
- Ensure Vindicia has been authorized as a presenter on the payment processor account.
- Use REST PMT to tokenize the card in Subscribe. This has the effect of vaulting the card without your server ever having to save or store the PCI components of the card number (primary account number [PAN]), expiration date, or card verification number [CVN]).
-
If you have a requirement to calculate and show taxes or campaign discounts before the subscriber commits to the purchase, you must make two calls to the subscription API. It is optional to use
dryrunfor this purpose as described here, but is very common among merchants. The first call uses thedryrunoption that serves as a quote, which causes Subscribe to calculate taxes and discounts, and return them in the call response, but does not save the subscription, and no charges are sent to the processor. Since the subscription is not saved in this case, you cannot fetch it after thedryruncall.-
To add the
dryrunoption to the POST, use the following sample code:POST https://api.staging.us-west.vindicia.com/subscriptions?dryrun=1 -
The second call does not set
dryrun, and creates the subscription in Subscribe and sends any resulting billing charges to the processor, which will charge the subscriber’s payment method.
-
To add the
-
If you are not using
dryrunas described above, you can either setdryrunto0explicitly, or omit the option from the POST, as follows:POST https://api.staging.us-west.vindicia.com/subscriptionsTo initiate a dry run or create the subscription, you must include the following in the POST call at a minimum.Sample Code For examples of subscription related REST calls, see: Github REST examples for subscription. The following is an example of the JSON REST payload used to create the subscription:POST https://api.staging.us-west.vindicia.com/subscriptions
- A proper Subscription with Account and PaymentMethod objects are created in Subscribe.
- The initial Transaction is generated if applicable, including any applicable taxation.
- Future billings are correctly predicted.
- The Account has been granted appropriate Entitlements.

