Gateway
Learn how to create Stripe-like checkout experiences for Pi payments using our Gateway
ZyrapayGateway provides a Stripe-like checkout service where developers can easily integrate Pi payments into their applications. Create checkout sessions, manage payments, and receive Pi payments with just your API key.
How It Works
- Call our API to create a checkout session with your order metadata
- We return a payment URL to redirect your user to
- User pays on our secure checkout page
- We process the payment and send you a webhook notification with your metadata
- You extract the metadata to identify the order and confirm it on your side
You don't handle any payment processing. We handle everything and just notify you when it's done.
Metadata: Include your order ID or any metadata when creating the checkout - we'll send it back in the webhook so you can match it to your system.
API Endpoints
Below are the core API endpoints for creating and managing Pi payment checkouts:
POST api.checkout.zyrapay.net – Create a new checkout sessionGET api.checkout.zyrapay.net/checkoutId – Get checkout session detailsRequest Parameters
Here are all the parameters you can send when creating a checkout session:
Required Parameters
items (array) - Array of items to purchaseEach item should include: name, description, quantity, image, amount
successUrl (string) - URL to redirect after successful paymentcancelUrl (string) - URL to redirect if payment is cancelledcurrency (string) - Currency code (i.e. "USD")webhookUrl (string) - URL to receive payment notificationsOptional Parameters
expiresInMinutes (number) - Checkout expiration time (default: 30 minutes)metadata (object) - Custom data to store with the checkoutItems Structure
The items array can contain as many products as you want. Each item represents a product in your checkout:
Item Object Structure
name (string) - Product namedescription (string) - Product descriptionquantity (number) - How many of this itemimage (string) - Product image URLamount (number) - Price per itemMultiple Items: You can send as many items as needed. Perfect for shopping carts, subscriptions, or any multi-product purchase.
Complete Implementation Example
Here's a complete example showing how to implement checkout in your application:
JavaScript Implementation
Webhooks
We send webhooks when checkout payments are processed. Include your webhookUrl when creating checkout.
Webhook Types
checkout.paid- Exact payment amount receivedcheckout.overpaid- More than required amount paidcheckout.underpaid- Less than required amount paid
Each webhook includes type and data fields.