Samsung Pay on your own checkout
If you want to place the Samsung Pay button on your website, you can use the library developed by bePaid. It is compatible with the parameters and properties of the payment widget library.
Follow the steps below:
1. Install the script on your website:
<script type="text/javascript" src="https://js.bepaid.by/widget/samsung_pay.js"></script>
2. Place a frame for a Samsung Pay button on the page:
<div id="samsung-pay-button"></div>
3. Add the following JavaScript-code to start the Samsung Pay payment processing:
Code example with the token
<script defer>
const params = {
checkout_url: "https://checkout.bepaid.by",
containerId: "samsung-pay-button",
token: "{PAYMENT TOKEN}",
onSuccess: (response) => {},
onInitalError: (error) => {},
};
new SamsungPay(params);
</script>
Code example with the public key
<script defer>
const params = {
checkout_url: "https://checkout.bepaid.by",
containerId: "samsung-pay-button",
public_key: "{SHOP PUBLIC KEY}",
checkout: {
transaction_type: "payment",
order: {
currency: "USD",
amount: 100,
description: "Test description",
},
test: true,
},
onSuccess: (response) => {},
onInitalError: (error) => {},
};
new SamsungPay(params);
</script>
Parameter | Type | Description |
---|---|---|
checkout_url * required |
string | https://checkout.bepaid.by |
token | string | A payment token. To get the token, make a request described on the Payment token page. |
public_key * conditionally required |
string | The shop public key. Required if the token parameter is not sent. |
onSuccess | callback function | Parameter for processing webhook notifications about the transaction results. |
onInitalError | callback function | Parameter for processing webhook notifications about payment initialization errors. |