IV. Other Setups - volkswagner/erpusa GitHub Wiki
Similar to Stripe Plus Checkout, there are other features of Stripe Plus that require initial setups.
Setting Up Auto Repeat with Stripe Plus
By default, Auto Repeat creates a doc derived from a template doc and informs the concerned party via email. Stripe Plus can override this workflow by making a Payment Request instead of directly sending an email. This can be beneficial if the goal is standardization and if a billing with Payment Gateway is needed.
Allowing Payment Requests to be Made
Once the Auto Repeat is initially set up, do the following.
- Click the Notification tab.
- Navigate to the Stripe Plus section.
- Check Send payment request instead. Doing so will automatically check Notify by Email.
- Enter the recipients, subject and message of the email. Remember to include the
{{ payment_url }}string. - Go back to the Stripe Plus section and set a Payment Gateway Account if needed,
- If it’s for Stripe, choose a Payment Method Configuration.
- Click Save.
Setting Up Subscription with Stripe Plus
An ERPNext Subscription can also be made into a Stripe Subscription. This allows automatic payments and accounting.
Important: Integrating Stripe Plus to Subscription locks the fields generate_invoice_past_due_date, submit_generated_invoice and generate_invoice_at. This ensures compatibility and error-free accounting.
Making ERPNext Subscription Also a Stripe Subscription
Once the Subscription is initially set up, do the following.
- Go to the Stripe Plus section.
- Set a friendly_name. This will override the Subscription ID in emails and in the portal page.
- Check Autocharge with Stripe. This serves as the trigger to create the Subscription in Stripe.com.
- Choose a Payment Gateway Account.
- Choose a Payment Method Configuration,
- Choose a Contact doc for the User Account Representative.
- Click Save.
After saving, the Stripe Subscription will be created in the background and refreshing the page will reveal the Email Status and Payment URL. The Customer will then receive an email to set up a default payment method. To prevent issues with the accounting automation, the email will be sent on the day when the Subscription starts.
When the Customer successfully makes the initial payment, the ERPNext Subscription will finally be synced with Stripe. The Stripe Subscription ID and Status fields will be exposed and an intro message will appear that indicates the current Subscription status.
Setting Up Custom Payment Gateway
There are a lot of advantages in using a Payment Gateway Account. Apart from allowing customers to pay online, Payment Gateway allows (1) associating a Ledger Account, (2) setting a default communication channel, and (3) configuring an email template to a Payment Gateway Account doc. These added features come in handy in simplifying and standardizing Payment Requests.
These features can still be used without using the built-in Payment Gateway Platforms through a Custom Payment Gateway. Custom Payment Gateway is a Stripe Plus setup that emulates a standard Payment Gateway Account. It can be used in Payment Requests like a standard Payment Gateway Account without the complications of payment_url and checkout page—only the added features. Below are sets of instructions to setup a Custom Payment Gateway
I. Setting Up Custom Gateway Settings
A user-made Gateway Settings is the foundation and the most crucial. This imitates the DocTypes Stripe Settings, Razorpay Settings, etc:
- Create a new DocType.
- Name it with a ‘Settings’ suffix. (For example, ‘Check Settings’)
- Add a Data-type field named ‘settings_name’ and make it mandatory.
- In the settings of the DocType,
- Check the Custom? field. This is crucial as this will recognize the doctype as a Custom Gateway Settings.
- Set the naming convention to fieldname and write ‘settings_name’.
- Click Save.
II. Setting Up Doc for the Custom Gateway Settings
- Similar to configuring a Stripe Settings, a doc must be created to set up a Payment Gateway:
- Create a doc for the Custom Gateway Settings.
- Name the custom Settings.
- Click Save.
III. Setting Up Custom Payment Gateway:
- Create a new Payment Gateway doc.
- In the pop-up, click the Edit Full Form button to reveal all the necessary fields.
- In the form,
- Name the gateway.
- Select the Custom Gateway Settings for gateway_settings field
- Select the doc you created in the gateway_controller field.
- Click Save.
IV. Setting Up Custom Payment Gateway Account
- Create a new Payment Gateway Account doc.
- In the form, select the Custom Payment Gateway doc in the payment_gateway field and select the associated Account in payment_account.
When the setup is done, it can now be used for Payment Request.