Accept Blue Subscriptions

Accept Blue Subscriptions

Create recurring subscriptions with the Accept Blue platform.

npm install @pinelab/vendure-plugin-accept-blue
Latest version2.2.0
Compatibility>=2.2.0
Last publishedJan 14, 2025
Pinelab
PinelabWebshops for mission-driven brands and wholesalers

Official documentation here

Create recurring subscriptions with the Accept Blue platform.

  1. A customer places an order with products that represent subscriptions
  2. Customer adds a payment to order with addPaymentToOrder and supplies credit card details:
    • A customer is created in Accept Blue
    • A payment method with the card details is added to the customer
    • A charge is created for the customer with the initial amount due
    • A recurring subscription(s) for that customer is created
  3. If all succeed, the order is transitioned to PaymentSettled
  1. Add to your Vendure config:
  1. Start the server, create a payment method and select Accept Blue as handler
  2. Place an order and use one of the payment methods below:

:warning: Set Use test mode in your payment handler in the admin UI to use Accept Blue in test mode.

Payment methods

These are the different payment methods you can use to pay for an order. Keep in mind that these examples use sample input data.

Pay with Saved Payment Method

If a customer already has a payment method saved in Accept Blue, you can use that to pay for an order.

Pay with Check

Pay with Nonce/Tokenized card

With the hosted tokenization form, you can obtain a token that represents a credit card, and use that to pay for an order. More info on hosted tokenization here: https://docs.accept.blue/tokenization/v0.2

Fetching Transactions and Subscriptions for placed orders

After an order is placed, the order.lines.acceptBlueSubscriptions is populated with the actual subscription values from the Accept Blue platform, so it will not call your strategy anymore. This is to better reflect the subscription that was actually created at the time of ordering.

This means you can now also get the transactions per subscriptions with the field order.lines.acceptBlueSubscriptions.transactions. To refund a transaction, you first need to get the transaction id.

Refunding

Only the initial payment is handled as a Vendure payment, any other refunds are done via a dedicated mutation:

  1. Fetch transactions for a customer or a subscription as explained above
  2. Use the transaction ID to create a refund:

The arguments amount and cvv2 are optional, see the Accept Blue Docs for more info.

Updating Subscriptions

You can update created subscriptions in Accept Blue as Admin via de admin-api with UpdateOrder permissions:

This wil emit an AcceptBlueSubscriptionEvent of type updated.

CORS

If you run into CORS issues loading the Accept Blue hosted tokenization javascript library, you might need to remove the cross-origin key on your script tag.

Incoming events and webhooks

This plugin emits an AcceptBlueTransactionEvent whenever it receives a webhook with a transaction update from Accept Blue.