1.0.9 • Published 4 years ago
@tripartie/webapi-jsclient v1.0.9
TripartieWebAPI - JSClient
The Tripartie Web API allows you to easily create Transaction templates. Those templates allows a User (the Buyer) to quickly initiate a Transaction pre-configured by another User (the Seller). This allows you to add a Secured Payment button on your website pages.
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0
- Package version: 1.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
Installation
Using npm
npm install @tripartie/webapi-jsclient --save
In <script>
HTML tag
<script src="https://cdn.jsdelivr.net/npm/@tripartie/webapi-jsclient/dist/tripartiewebapi-jsclient.min.js"></script>
Getting Started
Please follow the installation instruction and execute the following JS code:
// Only if using with npm. This is not required with `<script>` tag.
const TripartieWebAPI = require('@tripartie/webapi-jsclient');
const defaultClient = TripartieWebAPI.ApiClient.instance;
const ClientIdAuth = defaultClient.authentications['ClientIdAuth'];
ClientIdAuth.apiKey = "YOUR CLIENT ID"
const usersApi = new TripartieWebAPI.UsersApi();
const user = {
email: "john.doe@gmail.com",
externalId: "johndoe42",
};
usersApi.register(user)
.then((user) => {
console.log('User registered', user);
})
.catch((err) => {
console.error('Could not register user', err);
});
const transactionTemplatesApi = new TripartieWebAPI.TransactionTemplatesApi()
const template = {
title: "Playstation 5",
description: "Brand new",
subTotal: 50000,
externalId: "playstation5-436",
sellerExternalId: "johndoe42",
currency: "EUR",
flow: "objects",
adUrl: "https://my-website.com/ads/playstation5-436",
};
transactionTemplatesApi.create(template)
.then((transactionTemplate) => {
console.log('Transaction template created', transactionTemplate);
})
.catch((err) => {
console.error('Could not create transaction template', err);
});
Documentation for API Endpoints
All URIs are relative to https://platform.preprod.tripartie.com
Class | Method | HTTP request | Description |
---|---|---|---|
TripartieWebAPI.TransactionTemplatesApi | fetch | GET /api/web/transaction-templates/ | Fetch |
TripartieWebAPI.TransactionTemplatesApi | create | POST /api/web/transaction-templates/ | Create |
TripartieWebAPI.UsersApi | unregister | DELETE /api/web/users/ | Unregister |
TripartieWebAPI.UsersApi | fetch | GET /api/web/users/ | Fetch |
TripartieWebAPI.UsersApi | register | POST /api/web/users/ | Register |
TripartieWebAPI.WebhooksApi | validate | GET /api/web/webhooks/ | Validate |
Documentation for Models
- TripartieWebAPI.Error
- TripartieWebAPI.ModelTransactionTemplate
- TripartieWebAPI.ModelUser
- TripartieWebAPI.RequestCreateTransactionTemplate
- TripartieWebAPI.RequestRegisterUser
- TripartieWebAPI.Webhook
Documentation for Authorization
ClientIdAuth
- Type: API key
- API key parameter name: client-id
- Location: URL query string
Troubleshooting
Webpack
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}