Setup a Site
Create a Site on Digital Experience
Create a permission Set to give guest users access to objects to read and create on objects and fields
Setup Sharing Rules to allow guest users to create and read records
Set up Webhook Event
Copy the URL of the created site
Go to Stripe Account and search for webhook and Add Enpoint (if you don’t have existing endpoint).
In add endpoint, paste your site url and add additional text on your site like your url + /services/apexrest/PosiPay/v1/Webhook/)
Add your description
In Select Events, look for charge, click it and select charge.refunded.
Click Add Events and after that, click Add Endpoint
Setup Payment Refund Button
In Gateway Transaction, add a Payment Refund button on the page layout
Refund Payment Functionality
If the current Gateway Transaction record Record Type is not Transaction,
If the current Gateway Transaction record Record Type = Transaction BUT has Transaction Status = Pending,
If the current Gateway Transaction record has Record Type = Transaction BUT has Transaction Status = Failed,
If the current Gateway Transaction record has Record Type = Transaction BUT has Transaction Status = Refunded,
If the current Gateway Transaction record has Record Type = Transaction AND Transaction Status != Pending/Failed/Refunded,
· The Refund Payment page will display
When Refunding a payment
If the refund is successful
A new Gateway Transaction will be created for refund and the source transaction will be its parent gateway transaction where the refund is being process/held
If the refund is failed
No Gateway Transaction where Record Type is Refund will not be created