Skip to content
Longplay
Docs
Browse docs / Testing

Testing

Test payments, notifications, retries and idempotency in Sandbox.

Markdown
API v1

Build in Sandbox#

  • Build and test with a Sandbox Server Key. Sandbox Customers, purchases and usage are fully separate from Live.
  • Create Customers from fixed test user IDs such as test-user-1; repeated runs return the same Customer.
  • Before launch, follow the go-live checklist to create Live Keys and publish your configuration in Live.

Related: Go-live checklist

Test payments#

Connect a Stripe test-mode account to Sandbox under Payment connections in Console, then use Stripe test cards on the payment page with any future expiry and any 3-digit CVC.

Related: Set up Stripe first: API key, webhook and activation

Common test cards
Card numberResult
4242 4242 4242 4242Payment succeeds
4000 0000 0000 0002Payment is declined
4000 0025 0000 3155Requires 3D Secure authentication

Common test cards

  • 4242 4242 4242 4242

    Result
    Payment succeeds
  • 4000 0000 0000 0002

    Result
    Payment is declined
  • 4000 0025 0000 3155

    Result
    Requires 3D Secure authentication
  • After paying, call readSubscriptionOperation until the status is complete, then confirm access with readHoldings.
  • Test refunds with previewRefund and refund, and confirm access is kept or revoked as chosen.

Test notifications#

  • The receiver must be public HTTPS. During local development, expose your local server with an HTTPS tunnel and enter that address under App notifications in Console.
  • Trigger a real event, such as reporting usage, and confirm usage.consume arrives and its signature verifies.
  • Replay the same event from the delivery list in Console and confirm your service deduplicates it by event ID.

Related: Notifications and webhooks

Test retries and idempotency#

  • Send the same write twice with the same requestId or idempotencyKey and confirm it returns the original result without running again; responses with a replayed field return true.
  • Sending the same ID with different content should return CONFLICT.
  • After a simulated timeout, recover by reading the original operation and retrying with the original ID; confirm no second charge or purchase appears.

Related: Idempotency and retries