refundTransaction( )
Retrieves payment provider information about a newly created refund.
Description
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.
Syntax
function refundTransaction(options: RefundOptions): Promise<RefundResponse>
refundTransaction Parameters
NAME
TYPE
DESCRIPTION
Information to use when creating a refund request.
Returns
Fulfilled -
Return Type:
NAME
TYPE
DESCRIPTION
Payment provider refund ID.
Error code supplied by the payment provider if the refund request fails.
Error message supplied by the payment provider if the refund request fails.
Was this helpful?
1// Place this code in the <my-extension-name>.js file2// in the 'payment-provider' folder of the3// Custom Extensions section on your site.45export const refundTransaction = async (options, context) => {6 //Logic for refunding a transaction with the payment provider.7 return {8 "pluginRefundId" : "16423-234234"9 }10};
1// Place this code in the <my-extension-name>.js file2// in the 'payment-provider' folder of the3// Custom Extensions section on your site.45export const refundTransaction = async (options, context) => {6 //Logic for refunding a transaction with the payment provider.7 return {8 "pluginRefundId" : "16423-234234",9 "reasonCode" : 3025,10 "errorCode" : "INSUFFICIENT_FUNDS_FOR_REFUND",11 "errorMessage" : "Insufficient funds for refund"12 }13};