Init the library
Init configuration
Init the library with the method init() by passing a parameter object of type ParamsType.
Here is a resume of all parameters available:
Name | Description | Required | Default | Type |
|---|---|---|---|---|
paymentOrder | Payment order information
| Yes in |
| Object |
publicKey | Public key of your Paygreen shop. Yours can be found or created here | Yes | null | String |
instrument | Instrument information
| No |
| Object |
paymentMethod | Force the payment method to display. If empty, null or undefined will list all the payment methods available for the payment order. Otherwise will display the payment method corresponding to the string value. Useless if instrument is provided. Doesn't work for apple_pay and google_pay due to security policy | Yes in | null | String |
mode | Choose how the library will work. Payment mode will execute a payment. | Yes |
| String |
modeOptions | Options to define for each mode. Actually only used in instrument mode AuthorizedInstrument: define if the instrument will be authorized or not. True by default, when authorized by paymentMethod ShopId: precise for which shop you want to create this instrument | No |
| Object |
style | Pass a custom style to the payment form. Will apply to inputs inside the iframes | No | Null | Object |
buyer | Buyer information
| No |
| String |
lang | Change language of the forms | No | Browser language | String |
display | Define whether you want to display the card and CVV icons, as well as how you want to display the 3DS. ( | No |
| Object |
Details parameters types are available here
Example
paygreenjs.init({
paymentOrder: {
id : "po_xxxxxxxxxxxxxxxxxxx", <!--Add your payment order IDD-->
objectSecret: "xxxxxxxxxxxx" <!--Add the payment order objectsecret here -->
},
publicKey: "pk_xxxxxxxxxxx", <!--Add your public key heree-->
mode: "payment",
});Updated 19 days ago