1.0.3 • Published 3 years ago

swirepay-js v1.0.3

Weekly downloads
58
License
Android SDK
Repository
-
Last release
3 years ago

swirepay_api

SwirepayApi - JavaScript client for swirepay_api Swirepay REST APIs' are resource-oriented URLs that accept JSON-encoded request bodies, return JSON-encoded responses, and use standard HTTP response codes, authentication, and verbs. You can use the Swirepay API in test mode, which does not affect your live data or interact with the banking networks. The API key you use to authenticate the request determines whether the request is live mode or test mode. This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.3
  • Package version: 1.0.3
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install swirepay_api --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your swirepay_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

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
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var SwirepayApi = require('swirepay_api');

var defaultClient = SwirepayApi.ApiClient.instance;
// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['x-api-key'] = "Token"

var api = new SwirepayApi.CustomerApi()
var customerRequest = new SwirepayApi.CustomerRequest(); // {CustomerRequest} 
var opts = {
  'destinationAccount': "destinationAccount_example" // {String} If processing on behalf of another Swirepay affiliate account
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.addCustomer(customerRequest, opts, callback);

Documentation for API Endpoints

All URIs are relative to https://api.swirepay.com/v1

ClassMethodHTTP requestDescription
SwirepayApi.CustomerApiaddCustomerPOST /customerAdd a new customer
SwirepayApi.CustomerApideleteCustomerByGidDELETE /customer/{gid}Delete customer by Gid
SwirepayApi.CustomerApigetAllCustomersGET /customerGet all customers
SwirepayApi.CustomerApigetCustomerByGidGET /customer/{gid}Get Customer by Gid
SwirepayApi.CustomerApiupdateCustomerPATCH /customer/{gid}Update Customer by Gid
SwirepayApi.DisputeApigetAllDisputesGET /disputeGet All Disputes
SwirepayApi.DisputeApigetDisputeByGidGET /dispute/{gid}Get dispute by Gid
SwirepayApi.InvoiceApiaddInvoicePOST /invoiceAdd a new invoice
SwirepayApi.InvoiceApigetAllInvoicesGET /invoiceGet All Invoices
SwirepayApi.InvoiceApigetInvoiceByGidGET /invoice/{gid}Get invoice by Gid
SwirepayApi.InvoiceApipayInvoicePATCH /invoice/{gid}/paypay for invoice
SwirepayApi.InvoiceApiupdateInvoiceActivePATCH /invoice/{gid}/activeUpdate invoice to active
SwirepayApi.InvoiceApiupdateInvoiceDraftPATCH /invoice/{gid}/draftUpdate invoice to draft
SwirepayApi.PaymentLinkApiaddPaymentLinkPOST /payment-linkAdd a new Payment Link
SwirepayApi.PaymentLinkApicancelPaymentLinkByGidPATCH /payment-link/{gid}/cancelGet Payment Link by Gid
SwirepayApi.PaymentLinkApigetAllPaymentLinkGET /payment-linkGet All payment Link
SwirepayApi.PaymentLinkApigetPaymentLinkByGidGET /payment-link/{gid}Get Payment Link by Gid
SwirepayApi.PaymentMethodApiaddPaymentMethodPOST /payment-methodAdd Payment Method
SwirepayApi.PaymentMethodApideletePaymentMethodDELETE /payment-method/{gid}Delete Payment Method
SwirepayApi.PaymentMethodApigetPaymentMethodByGidGET /payment-method/{gid}Get Payment Method by Gid
SwirepayApi.PaymentSessionApiaddPaymentSessionPOST /payment-sessionAdd a new payment ssession
SwirepayApi.PaymentSessionApicancelPaymentSessionPATCH /payment-session/{gid}/cancelCancel Payment Session
SwirepayApi.PaymentSessionApicapturePaymentSessionPATCH /payment-session/{gid}/captureCapture Payment Session
SwirepayApi.PaymentSessionApiconfirmPaymentSessionPATCH /payment-session/{gid}/confirmConfirm Payment Session
SwirepayApi.PaymentSessionApigetAllPaymentSessionGET /payment-sessionGet all payment session
SwirepayApi.PaymentSessionApigetPaymentSessionByGidGET /payment-session/{gid}Get Payment Session by Gid
SwirepayApi.PaymentSessionApinotifyPaymentSessionByGidGET /payment-session/{gid}/notifyNotify Payment Session by Gid
SwirepayApi.PaymentSessionApirefundPaymentSessionPATCH /payment-session/{gid}/refundRefund Payment Session
SwirepayApi.PaymentSessionApiupdatePaymentSessionPATCH /payment-session/{gid}/updateUpdate Payment Session
SwirepayApi.PayoutApigetAllPayoutsGET /payoutGet All payouts
SwirepayApi.PayoutApigetPayoutByGidGET /payout/{gid}Get payout by Gid
SwirepayApi.PlanApiaddPlanPOST /planAdd a new plan
SwirepayApi.PlanApigetAllPlanGET /planGet All Plan
SwirepayApi.PlanApigetplanByGidGET /plan/{gid}Get Plan by Gid
SwirepayApi.PlanApiupdatePlanPATCH /plan/{gid}Update Plan
SwirepayApi.PublicKeyApigetAllPublicKeyGET /public-keyGet All Public Key
SwirepayApi.PublicKeyApirollPublicKeyByGidPATCH /public-key/{gid}/rollRoll Public Key by Gid
SwirepayApi.RefundApigetAllRefundsGET /refundGet All Refunds
SwirepayApi.RefundApigetRefundByGidGET /refund/{gid}Get refund by Gid
SwirepayApi.SecretKeyApigetAllSecretKeyGET /secret-keyGet All Secret Key
SwirepayApi.SecretKeyApirollSecretKeyByGidPATCH /secret-key/{gid}/rollRoll Secret Key by Gid
SwirepayApi.SubscriptionApiaddSubscriptionPOST /subscriptionAdd a new subscription
SwirepayApi.SubscriptionApicancelSubscriptionPATCH /subscription/{gid}/cancelCancel Subscription
SwirepayApi.SubscriptionApigetAllSubscriptionGET /subscriptionGet All Subscription
SwirepayApi.SubscriptionApigetSubscriptionByGidGET /subscription/{gid}Get Subscription by Gid
SwirepayApi.TransactionApigetAllTransactionGET /transactionGet All transactions
SwirepayApi.WebhookApiaddWebhookPOST /webhookAdd new webhook
SwirepayApi.WebhookApideleteWebhookDELETE /webhook/{gid}Delete webhook
SwirepayApi.WebhookApigetAllWebhookGET /webhookGet All Webhook
SwirepayApi.WebhookApigetWebhookByGidGET /webhook/{gid}Get webhook by gid
SwirepayApi.WebhookApiupdateWebhookPATCH /webhook/{gid}Update webhook

Documentation for Models

Documentation for Authorization

api_key

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header
1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago