Prerequisites
- A test API key. See Authentication.
- A registered webhook endpoint. See Webhook Setup to register your URL and obtain your signing key.
Step 1: Create a payment session
Create a session server-side using your secret key. The minimum required fields areamount and currency.
amount is always specified in minor units. See Monetary Amounts for details.session_url (the hosted checkout page your customer will use to complete payment) and an id you will use to match the subsequent webhook event.
Step 2: Launch the checkout
Redirect your customer to thesession_url, or embed it using the JavaScript SDK for an in-page modal or inline experience.
The session remains active until the customer completes payment or the session expires. Do not poll for status. Use the webhook in the next step instead.
Step 3: Handle the completion webhook
When the customer completes payment, Moment sends apayment_session.completed event to your registered webhook endpoint.
data.id in the event to the session you created in Step 1 to confirm which order was paid.
Before processing, verify the event signature to confirm it originated from Moment. See Webhook Verification for the full verification steps and code samples.
Respond with a 2xx status code to acknowledge receipt. If your endpoint does not respond in time, Moment will retry delivery.
Testing
Use test card4242 4242 4242 4242 with any future expiry date and any 3-digit CVC to simulate a successful payment. See Integration Testing for the full list of test cards and error scenarios.
Next steps
Quickstart: Recurring Payments
Set up a mandate and collect future payments without customer interaction.
JavaScript SDK
Embed checkout directly in your page with the Moment JS SDK.

