Web SDK Introduction
Gather payment data from your customers' browsers, for use in payments on your server.
Depending on your requirements, you may need to get your client to directly make calls to the REST API, in addition to your server. The BR-DGE Web SDK helps you gather payment data from your customers' browsers, for use in payments on your server.
- The BR-DGE Web SDK helps you gather payment data from your customers' browsers. The SDK will handle any necessary communication with the REST API (using your Client API Key).
- Your web client passes the payment information to your server.
- Your server creates payments via the REST API (using your Server API Key).
The BR-DGE Web SDK can help you gather information required for payments, but only a server with a Server API Key can create payment transactions. This ensures that it is not possible to create unauthorized payment transactions using keys visible to client devices.
Prerequisites
Before you begin, you will need an app capable of displaying web content, and a Client API Key.
Comcarde JavaScript Client
At a minimum, you will need to create a Comcarde JavaScript Client in your app.
First, load the client code for your target environment:
<script src="https://sandbox-assets.comcarde.com/web/v2/js/client.min.js"></script>
<script src="https://assets.comcarde.com/web/v2/js/client.min.js"></script>
Finally, create an instance of the Comcarde JavaScript Client:
comcarde.client.create(
{
authorization: client - api - key, // your client API Key
},
function (clientErr, clientInstance) {
if (clientErr) {
console.error(clientErr)
return
}
// This is where you will configure the plugin modules...
}
)
Additional functionality can be added to your Comcarde JavaScript Client in the form of pluggable modules. This allows you to only pull in what you need, keeping your app footprint small.
Errors
Errors returned by the SDK will contain a response code providing information about the cause. The code
field can be mapped to an appropriate message to your customer while the message
field provides a short description to help with debugging.
{
code: '4001',
message: 'Access denied.',
}
Updated about 1 month ago