> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: refundTransaction(options: RefundOptions, context: Context) # Method package: wixPayments # Method menu location: wixPayments --> PaymentProvider --> refundTransaction # Method Link: https://dev.wix.com/docs/velo/events-service-plugins/payments/service-plugins/wix-payments/payment-provider/refund-transaction.md # Method Description: Retrieves payment provider information about a newly created refund. This function is called by Wix Payments when you create a refund from your site's dashboard. The code implemented in this function sends a request to the payment provider's API to create a refund. The function returns refund information from the payment provider, or error information if refund creation fails. Wix uses the information returned by this function to add the refund to your site. >**Note:** This function has a second parameter called `context`. This parameter is for internal Wix use only. >You don't need to use it in your code. ### Where to find `refundTransaction()` When you [add the Payment Provider service plugin](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-pay/tutorial-payment-provider-custom-extension.md#step-1-create-a-new-payment-provider-extension), a folder is automatically added to your site. Use the `.js` file in the folder to write the custom code for your payment provider. For more information on customizing your payment provider, see [Tutorial: Payment Provider Service Plugin](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-pay/tutorial-payment-provider-custom-extension.md#my-extension-namejs). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Successful refund ```javascript // Place this code in the .js file // in the 'payment-provider' folder of the // Service Plugins section on your site. export const refundTransaction = async (options, context) => { //Logic for refunding a transaction with the payment provider. return { "pluginRefundId" : "16423-234234" } }; ``` ## Failed refund ```javascript // Place this code in the .js file // in the 'payment-provider' folder of the // Service Plugins section on your site. export const refundTransaction = async (options, context) => { //Logic for refunding a transaction with the payment provider. return { "pluginRefundId" : "16423-234234", "reasonCode" : 3025, "errorCode" : "INSUFFICIENT_FUNDS_FOR_REFUND", "errorMessage" : "Insufficient funds for refund" } }; ``` ---