In this article, we get familiar with the flow of your first transaction via PayPal. 

                     

Authorization


    The authorization is required for transmitting requests to SolidGate. It can be performed by signing each client's request to API. You should apply the merchant ID and its secret key to generate the signature. 

    

Kindly find the dev specifications on the matter here



PayPal button integration flow


First of all, kindly request PayPal sandbox credentials from your Account Manager or by request to support.solidgate.com. 


After receiving API keys to the PayPal sandbox environment, kindly follow the documentation


Short flow on how to generate PayPal button below:


1. Kindly send an init request to

https://gate.solidgate.com/api/v1/init-payment 


2. You will get responsive with "scriptUrl."


3. Display the following code on the page:


<div id="paypal-button"></div>

<script>

    var elem = document.getElementById('paypal-button');

    elem.addEventListener('order-started-processing', function (e) {

        console.log('order-started-processing',e);

    }, false);

    elem.addEventListener('order-processed', function (e) {

        console.log('order-processed',e);

    }, false);

    elem.addEventListener('order-already-processed', function (e) {

        console.log('order-already-processed', e)

    }, false);

    elem.addEventListener('button-ready', function (e) {

        console.log('button-ready', e)

    }, false);

    elem.addEventListener('button-error', function (e) {

        console.log('button-error',e);

    }, false);

</script>

<script type="text/javascript"

        src="scriptUrl"

        data-script=" "

        data-btn-id="solid_pay_btn"

        data-overlay="true"

        data-tittle="Tittle for payment widget"

        data-description="widget.data-description">

</script>


4. Receive a PayPal button.


5.  Press the PayPal button and pass the test user's authorisation (request from support). 


6. Receive callback notification.