The Payment Provider Backend API allows you to report transaction and refund events when implementing the Payment Provider Custom Extension. Use it together with the Payment Provider SPI.
Learn more about implementing a Payment Provider Custom Extension.
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 and 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.
function submitEvent(submitEventRequest: SubmitEventRequest): Promise<void>;
Submit event request object.
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 */
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.