> 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: createTransaction(options: CreateTransactionOptions, context: Context) # Method package: wixPayments # Method menu location: wixPayments --> PaymentProvider --> createTransaction # Method Link: https://dev.wix.com/docs/velo/events-service-plugins/payments/service-plugins/wix-payments/payment-provider/create-transaction.md # Method Description: Retrieves information about a newly created payment provider transaction. This function is called by Wix Payments when a site visitor places an order on your site. The code implemented in this function creates a new transaction with a payment provider. The function returns the transaction information, or error information if transaction creation fails. Wix uses the return values from this function to add the new transaction 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 `createTransaction()` 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. ## Payment approved instantly ```javascript // Place this code in the .js file // in the 'payment-provider' folder of the // Service Plugins section on your site. export const createTransaction = async (options) => { //Logic for creating a new transaction with the payment provider. return { "pluginTransactionId": "1832456-3561234", } }; ``` ## Payment declined instantly ```javascript // Place this code in the .js file // in the 'payment-provider' folder of the // Service Plugins section on your site. export const createTransaction = async (options) => { //Logic for creating a new transaction with the payment provider. return { "pluginTransactionId": "1832456-3561234", "reasonCode": 3012, "errorCode": "INSUFFICIENT_FUNDS", "errorMessage": "Insufficient funds" } }; ``` ## Payment pending ```javascript // Place this code in the .js file // in the 'payment-provider' folder of the // Service Plugins section on your site. export const createTransaction = async (options) => { //Logic for creating a new transaction with the payment provider. return { "pluginTransactionId": "1832456-3561234", "reasonCode": 5005 } }; ``` ## Payment with 3DS verification ```javascript // Place this code in the .js file // in the 'payment-provider' folder of the // Service Plugins section on your site. export const createTransaction = async (options) => { //Logic for creating a new transaction with the payment provider. return { "pluginTransactionId": "1832456-3561234", "redirectUrl": "https://www.example.com/redirect-from-sale" } }; ``` ---