This example demonstrates how to create a payment button that redirects customers to our gateway hosted payment page and enrolls them into a recurring billing plan.
Order Form Button for Recur Billing
This example demonstrates how to create a payment button that redirects customers to a Plug’n Pay hosted payment page and enrolls them into a recurring billing plan.
When the payment is completed, the transaction will automatically be associated with the recurring billing plan specified by the pr_plan_id field.
Requirements
Before implementing recurring billing integrations:
- Your account must be enabled for the Plug’n Pay Recurring Billing Service.
- The
pr_plan_idvalue must match an existing Payment Plan ID configured within your Plug’n Pay account. - The recurring billing plan must already be created before submitting transactions.
Example Code
<form method="POST" action="https://pay1.plugnpay.com/pay/">
<input type="hidden" name="pt_gateway_account" value="USERNAME">
<input type="hidden" name="pt_transaction_amount" value="5.00">
<input type="hidden" name="pr_plan_id" value="1">
<input type="submit" value="Subscribe Now">
</form>
How It Works
| Field | Description |
|---|---|
method="POST" |
Sends the payment data securely using an HTTP POST request. |
action="https://pay1.plugnpay.com/pay/" |
The Plug’n Pay hosted payment page URL. |
pt_gateway_account |
Your Plug’n Pay gateway account username. |
pt_transaction_amount |
The payment amount submitted with the transaction. |
pr_plan_id |
The recurring billing plan ID associated with the transaction. |
type="submit" |
Creates the payment button shown to the customer. |
Required Changes
Before using this example in production:
- Replace
USERNAMEwith your Plug’n Pay gateway account username. - Replace the transaction amount with your desired recurring payment amount.
- Replace
pr_plan_idwith a valid Payment Plan ID from your account.
Example:
<input type="hidden" name="pr_plan_id" value="monthly_plan">
Customized Example
<form method="POST" action="https://pay1.plugnpay.com/pay/">
<input type="hidden" name="pt_gateway_account" value="youraccount">
<input type="hidden" name="pt_transaction_amount" value="29.99">
<input type="hidden" name="pr_plan_id" value="monthly_plan">
<input type="submit" value="Start Subscription">
</form>
Customer Flow
- Customer clicks the subscription button.
- Customer is redirected to the Plug’n Pay hosted payment page.
- The recurring billing plan is automatically linked to the transaction.
- Customer securely enters payment information.
- The payment is processed and the recurring billing profile is created.
Notes
- The recurring billing schedule and processing rules are controlled by the Payment Plan configuration within your Plug’n Pay account.
- The
pr_plan_idfield references an existing plan and does not create plans dynamically. - Hosted payment pages help reduce PCI exposure by securely collecting payment information on Plug’n Pay servers.
- Additional billing, shipping, and customer information fields may also be submitted.
Common Use Cases
This integration method is commonly used for:
- Subscription services
- Membership billing
- Monthly donation programs
- SaaS billing
- Scheduled payment plans
Next Steps
After confirming recurring billing enrollment works correctly, you may want to explore:
- Trial period configurations
- Dynamic recurring plan selection
- Automated subscription management
- Customer billing portals
- Passing customer information automatically
- Recurring billing notifications