> 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: submitEvent(submitEventRequest: SubmitEventRequest) # Method package: wixPaymentProviderBackend # Method menu location: wixPaymentProviderBackend --> submitEvent # Method Link: https://dev.wix.com/docs/velo/apis/wix-payment-provider-backend/submit-event.md # Method Description: Updates the status of a transaction or refund. The `submitEvent()` function returns a Promise that resolves to `void` when the status of a transaction or refund is updated. Use this function with the [Payment Provider SPI](https://www.wix.com/velo/reference/spis/wix-payments/payment-provider/introduction) and [HTTP functions](/wix-http-functions) to allow payment providers to send your site updates about refunds and transactions. The status of a transaction or refund is updated based on the properties included in the argument passed to this function. See the code examples for details. Learn more about implementing a [Payment Provider Custom Extension](https://support.wix.com/en/article/velo-tutorial-payment-provider-custom-extension-beta). # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update the status of a transaction or refund ```javascript import wixPaymentProviderBackend from 'wix-payment-provider-backend'; /* * Sample submitEventRequest value for a transaction: * { * event : { * transaction: { * wixTransactionId: '3e01dda6-134e-4cc9-a37f-ed2bf756c684', * pluginTransactionId: '22001-123123' * } * } * } */ export async function updateTransaction(submitEventRequest) { try { await wixPaymentProviderBackend.submitEvent(submitEventRequest); console.log('Transaction updated successfully.'); return ; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to void */ ``` ## Transaction approved ```javascript // submitEventRequest value for a successful transaction: { event: { transaction : { wixTransactionId: '3e01dda6-134e-4cc9-a37f-ed2bf756c684', pluginTransactionId: 'e89b-12d3-a456-42665' } } } ``` ## Transaction declined ```javascript // submitEventRequest value for a declined transaction: { event: { transaction: { wixTransactionId: '3e01dda6-134e-4cc9-a37f-ed2bf756c684', pluginTransactionId: 'e89b-12d3-a456-42665', reasonCode: 3012, errorCode: 'INSUFFICIENT_FUNDS', errorMessage: 'Insufficient funds' } } } ``` ## Transaction pending ```javascript // submitEventRequest value for a pending payment { event: { transaction: { wixTransactionId: '3e01dda6-134e-4cc9-a37f-ed2bf756c684', pluginTransactionId: 'e89b-12d3-a456-42665', reasonCode: 5005 } } } ``` ## Transaction canceled ```javascript // submitEventRequest value for a canceled transaction: { event: { transaction: { wixTransactionId: '3e01dda6-134e-4cc9-a37f-ed2bf756c684', pluginTransactionId: 'e89b-12d3-a456-42665', reasonCode: 3030, errorCode: 'BUYER_CANCELED', errorMessage: 'Buyer canceled the transaction.' } } } ``` ## Refund succeeded, initiated from a site's dashboard ```javascript // submitEventRequest value for a successful refund that was initiated from a site's dashboard: { 'event': { 'refund': { 'wixTransactionId': '3e01dda6-134e-4cc9-a37f-ed2bf756c684', 'pluginRefundId': '123123-123123123', 'amount': '1000', 'wixRefundId': 'baeb40f5-a48a-4424-cec2-253c9772ad42' } } } ``` ## Refund failed, initiated from a site's dashboard ```javascript // submitEventRequest value for a failed refund that was initiated from a site's dashboard: { event: { refund: { wixTransactionId: '3e01dda6-134e-4cc9-a37f-ed2bf756c684', pluginRefundId: '1231231-55432', amount: '1000', wixRefundId: 'baeb40f5-a48a-4424-cec2-253c9772ad42', reasonCode: 3025, errorCode: 'INSUFFICIENT_FUNDS_FOR_REFUND', errorMessage: 'Insufficient funds for refund.' } } } ``` ## Refund succeeded, initiated by a payment provider ```javascript // submitEventRequest value for a successful refund that was initiated by a payment provider: { event: { refund: { wixTransactionId: '3e01dda6-134e-4cc9-a37f-ed2bf756c684', pluginRefundId: '123123-123123', amount: '1000' } } } ``` ---