Learn how to fulfill orders after a customer pays with Fanspay Checkout.
After you integrate Fanspay Checkout to take your customers to a payment form, you need a notification that you can fulfill their order after they pay.
In this guide, you’ll learn how to:
- Receive an event notification when a customer pays you.
- Handle the event.
- Turn on your event handler in production.
Create your event handler
In this section, you need to create a small event handler so Fanspay can send you a checkout.session.completed
event when a customer completes a checkout.
First, create a new route for your event handler.
Verify events came from Fanspay
Anyone can POST data to your event handler. Before processing an event, always verify that it came from Fanspay before trusting it.
Fulfill the order
To fulfill the order, you’ll need to handle the checkout.session.transaction_confirmed
event.
This event includes the Checkout Session object, which contains details about payment.
When handling this event, you might also consider:
- Saving a copy of the order in your own database.
- Sending the customer a receipt email.
Go live in production
After you’ve deployed your event handler endpoint to production, you need to register your live URL with Fanspay.