1.0.0-beta.0 • Published 4 years ago

digi-wallet-beta v1.0.0-beta.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

digi-wallet

This is NodeJS SDK for DigiWallet payment system. DigiWallet provides the link between payment methods and your application. This SDK provides easy approach and usage of DigiWallet API

Instalation

$ npm install digi-wallet

For detailed explanation on how things work, check out DigiWallet API documentation.

Supported payment methods

# Sofort
# Paysafecard
# Afterpay
# Bancontact
# Creditcard
# Ideal
# Paypal

Example

const options = {
    // outletId is Id provided by DigiWallet
    outletId: APP_ID,

    // returnUrl is url for redirect after a (successful) payment.
    returnUrl: RETURN_URL,

    // returnUrl is url where the visitor is sent after cancelling the payment
    cancelUrl: CANCEL_URL,

    // reportUrl is called by DigiWallet, after (server-to-server) payment as POST request.
    // Here you can check if the payment was indeed completed and process. 
    reportUrl: REPORT_URL,

    // test option can be 1 `as test mode` or 0 'prod mode'.
    test: 1,
};

// create instance of DigiWallet
const DW = new DigiWallet( options );

// desired payment method
const Sofort = DW.sofort();

// declare additional fields for specific payment (See DigiWallet API doc)
Sofort.country = 'DE';
Sofort.amount=1000;
Sofort.description = 'example description';

// Start with payment. 
// In transactionResponse you will get url for redirecting customer, 
// and you will get transactionId
Sofort.start().then(( transactionResponse ) => {

    if( transactionResponse.status ) {

        //...      
        
        // after you have proper transactionId you can check status of payment
        Sofort.check().then( ( checkData ) => {
            //...
        })

    }

}).catch( (err) => {

    //...

});
1.0.0-beta.1

4 years ago

1.0.0-beta.0

4 years ago