Testing Subscription Flows

It's important to verify that your subscription logic works as expected, including plan changes, and renewals. OpenPay supports a testing mode powered by your Stripe test account.

Testing Plan ChangesCopied!

To test subscription upgrades or billing cycle changes in your development environment follow the following steps:

  1. Update the Subscription

    Use the PUT /subscriptions/{subscription_id} endpoint to switch between monthly and yearly plans.

    Be sure to set the proration_behavior parameter appropriately:

    - none: apply the plan change now, but bill the new price at the next renewal.
    - always_invoice: invoice the customer immediately for the change.
    - create_prorations: prorate the unused time and apply it in the next invoice.

  2. Preview Upcoming Charges

    After making changes, call POST /invoices/preview endpoint to test the next invoice and confirm the amount and billing date are as expected.

NOTE: you can only move the subscription billing anchor to the next day. Testing further ahead in time isn’t supported.

How to Test Payment FailuresCopied!

To test failed payments like insufficient funds or invalid cards, follow these steps:

  1. Connect a Stripe Test Account

    Add your own Stripe test account in OpenPay settings, or contact us to access our shared Stripe test environment.

  2. Use Stripe Test Cards

    Stripe offers test card numbers to test different cases. Here are some examples:

    - 4000 0000 0000 9995 – Card declined
    - 4000 0000 0000 0341 – Insufficient funds
    - 4000 0000 0000 0069 – Expired card

  3. You can have a look at some of the common card errors here.

  4. Results in OpenPay

    When using test cards with a connected Stripe test account, OpenPay shows the error directly in your workflows.