• Mode = "payment": Allows you, from a payment order, to display the payment form according to what you defined in the payment order.
  • Mode = "instrument": Allows you to create instruments (cards) that can be reused one or more times.

Mode Payment

window.addEventListener("load", function () { paygreenjs.init({ paymentOrderID: "po_4b6c4203ff89488265ar971f45ac6ff9", objectSecret: "6a2d6828147f626d", mode: "payment", publicKey: "pk_231e1063b8fb324d9324acc9f94af8a5", instrument: "ins_fc6409dc32f248839295539623276cl98", // Optionnal paymentMethod: "bank_card", // Optionnal style: { input: { base: { color: "black", fontSize: "18px", }, }, }, }); });

Once the init method will be exectued, you should see the payment form (or the payment methods available if no paymentMethod is provided)

Mode Instrument

window.addEventListener("load", function () { paygreenjs.on( paygreenjs.Events.INSTRUMENT_READY, (event) => { const instrument = event.detail.instrument; // ...Handle instrument here } ); paygreenjs.init({ publicKey: "pk_231e1063b8fb324d9324acc9f94af8a5", mode: "instrument", buyer: "buy_34def8077f774cea8a6f58daojns65419", modeOptions: { authorizedInstrument: true, }, paymentMethod: "bank_card", }); });

Instrument mode provide you a valid instrument once the form has been completed. You will get the instrument (authorized or not) throught the INSTRUMENT_READY event. Tokenizing error will be return in the event TOKEN_FAIL.

You can create an instrument as a marketplace for a sub-shop using the params modeOptions.shopId passing the sub-shop id

After, for example, you can init PGJS in payment mode with this instrument (Pass the instrumentId as in the 1st example) to process the payment.

Mode Tokenizer (deprecated)

❗️

Tokenizer is deprecated

Please use mode Instrument instead. Mode tokenizer will not receive any more updates.


Did this page help you?