Skip to main content

Documentation

Create Subscription Message Sequences

Diagrams and steps for creating and managing a recurring payment for a service.

Prerequisites

Note

Subscriptions automatically create draft invoices during each billing cycle. Invoice payments are processed immediately when simultaneous invoice is set to true. When simultaneous invoice is set to false or not defined, invoice payments are processed 1 hour after invoices are created.

Create a Subscription

Subscription with Automatic Capture of Card Payment

This diagram shows the sequence of events when a subscription is created from a card. In this example, installment payments are made in advance, and authorization and capture occur simultaneously. The fraud check illustrated here is part of all card payment requests.

  1. The client sends a Create Subscription request to Rapyd.

  2. Rapyd sends a response with details of the subscription to the client. The status of the subscription is set to active.

  3. Rapyd sends Webhook - Subscription Created to the client.

  4. Rapyd sends Webhook - New Cycle Started to the client.

  5. Rapyd sends Webhook - Invoice Created to the client. The status of the invoice is set to draft.

  6. Rapyd sends Webhook - Invoice Finalized to the client. The status of the invoice is set to open.

  7. Rapyd requests a fraud check and payment from the card network.

  8. The card network approves the card and transfers the funds to Rapyd.

  9. Rapyd credits the client wallet and sends Webhook - Payment Completed to the client. The status of the payment is set to CLO (closed).

  10. Rapyd sends Webhook - Payment Succeeded to the client.

  11. Rapyd sends Webhook - Invoice Payment Created to the client.

  12. Rapyd sends Webhook - Invoice Payment Succeeded to the client. The status of the invoice is set to paid.

Subscription with Card 3DS Authentication

This diagram shows the sequence of events when a subscription is created from a card that requires 3DS authentication. After the customer passes 3DS authentication, the individual recurring payments are automatically processed without additional authentication.

  1. The client sends a Create Subscription request to Rapyd.

  2. Rapyd sends a response with details of the subscription to the client. The status of the subscription is set to active.

  3. Rapyd sends Webhook - Subscription Created to the client.

  4. Rapyd sends Webhook - New Cycle Started to the client.

  5. Rapyd sends Webhook - Invoice Created to the client. The status of the invoice is set to draft.

  6. Rapyd sends Webhook - Invoice Finalized to the client. The status of the invoice is set to open.

  7. Rapyd sends Webhook - Payment Succeeded containing the URL of the 3DS authenticator to the client. The status of the payment is set to ACT (active).

  8. The client sends the URL of the 3DS authentication site to the customer.

  9. The customer successfully completes the authentication requirements.

  10. The 3DS authentication site notifies Rapyd that the customer is authenticated.

  11. Rapyd requests payment from the card network.

  12. The card network approves and transfers the funds to Rapyd.

  13. Rapyd credits the client wallet and sends Webhook - Payment Completed to the client. The status of the payment is set to CLO (closed).

  14. Rapyd sends Webhook - Invoice Payment Created to the client.

  15. Rapyd sends Webhook - Invoice Payment Succeeded to the client. The status of the invoice is set to paid.

Subscription with a Trial Period

These diagrams show the sequence of events when a subscription is created with a trial period. You can define a trial period in a plan object attached to the subscription, or by setting trial_period_days in the Create Subscription request.

During Subscription Creation and Trial Period

  1. The client sends a Create Subscription request to Rapyd.

  2. Rapyd sends a response with details of the subscription to the client. The status of the subscription is set to trialing.

  3. Rapyd sends Webhook - Subscription Created to the client.

  4. Rapyd sends Webhook - New Cycle Started to the client.

  5. Rapyd sends Webhook - Invoice Created to the client. The status of the invoice is set to draft.

  6. Rapyd sends Webhook - Invoice Payment Succeeded to the client. The status of the invoice is set to paid, and the amount is set to zero.

  7. Three days before the end of the trial period, Rapyd sends Webhook - Trial Nearing End to the client.

When Trial Period Ends

  1. At the end of the trial period, Rapyd sends Webhook - New Cycle Started to the client. The status of the subscription is set to active.

  2. Rapyd sends Webhook - Invoice Created to the client. The status of the invoice is set to draft.

  3. Rapyd sends Webhook - Invoice Finalized to the client. The status of the invoice is set to open.

  4. Rapyd requests a fraud check and payment from the card network.

  5. The card network approves the card and transfers the funds to Rapyd.

  6. Rapyd credits the client wallet and sends Webhook - Payment Completed to the client. The status of the payment is set to CLO (closed).

  7. Rapyd sends Webhook - Payment Succeeded to the client.

  8. Rapyd sends Invoice Payment Created Webhook to the client.

  9. Rapyd sends Webhook - Invoice Payment Succeeded to the client. The status of the invoice is set to paid.

During Subscription Creation and Trial Period - Payment Failed

This diagram shows the sequence of events when the first installment payment for a new subscription fails. A payment can fail for many reasons, for example, the card has been blocked or does not have sufficient funds.

  1. The client sends a Create Subscription request to Rapyd.

  2. Rapyd sends a response with details of the subscription to the client. The status of the subscription is set as follows:

    • active - If no trial period is defined.

    • trialing - If a trial period is defined.

  3. Rapyd sends Webhook - Subscription Created to the client.

  4. Rapyd sends Webhook - New Cycle Started to the client.

  5. Rapyd sends Webhook - Invoice Created to the client. The status of the invoice is set to draft.

  6. Rapyd sends Webhook - Invoice Finalized to the client. The status of the invoice is set to open.

  7. Rapyd requests a fraud check and payment from the card network.

  8. The card network declines the payment.

  9. Rapyd sends Webhook - Invoice Payment Failed to the client. The status of the payment is set to ACT (active).

  10. Rapyd sends Webhook - Payment Failed to the client. The status of the payment is set to ERR (error).

  11. Rapyd sends Webhook - Subscription Unpaid to the client. The status of the subscription is set to unpaid.