Overview
This section shows you how to run and customize various Nuvei Checkout examples, using the JSFiddle demonstration environment.
Prerequisites
- In order to accept a payment, first perform the steps to initiate a session.
Checkout Examples
Initiating a Session
- Before you can submit a payment with our client-side Checkout, you need to send the /openOrder API call, which has two main functions:
- Authenticates you as our merchant using your given credentials. You can find your credentials here.
- Sets up an order in the Nuvei system to contain the transaction details, and returns a
sessionToken
, that is referenced later in thecheckout()
method and Checkout payment flow.
Editing Sample Code in JSFiddle
Each scenario contains example code that you can edit.
-
- To edit, click “Edit in JSFiddle” in the top right corner.
This redirects you to a page where you run and test the code. - On the JSFiddle page, set your credentials in the section at the top of the page:
var sfc = SafeCharge({ env: 'int', // Nuvei API environment - 'int' (integration) or 'prod' (production - default if omitted) merchantId: '', //as assigned by Nuvei merchantSiteId: '' // your Merchant Site ID provided by Nuvei });
- To edit, click “Edit in JSFiddle” in the top right corner.
Feel free to change your code, including the HTML and CSS. Have fun 🙂 !