Code Monkey home page Code Monkey logo

Comments (6)

srikanthonl avatar srikanthonl commented on May 29, 2024

The response the onPaymentStatus receives is whatever your server API that handled the purchase sends. So, your server should have a response from Braintree, before onPaymentStatus is called which gives you the response where you should find something like response.IsSuccessStatusCode which tells whether the transaction was a success. Its upto your api to decide what and how much details to return to ngx-braintree to make any decisions on the client side. ngx-braintree just receives whatever transaction response is sent by your server which you access via listening to paymentStatus event.

from ngx-braintree.

CodeAnomalies avatar CodeAnomalies commented on May 29, 2024

Amount is not passed to Paypal Checkout.
and my Purchase API is not being called when using Paypal Checkout so I am not getting anything on PaymentStatus()

Is my way of calling Paypal Checkout valid? Here is my code
This Code works perfectly when using braintree Drop-in, getting responce and evething is perfect but not working when using Paypal Checkout (I have linked my paypal sandbox account with braintree so that is not an issue)

<ngx-braintree 
    [clientTokenURL]="'/dev/get-client-token'"
    [createPurchaseURL]="'/dev/purchase-url'"
    [chargeAmount]="55.55"
    [buttonText]="'Pay'"
    (paymentStatus)="onPaymentStatus($event)"
    [enablePaypalCheckout] = "true"
    [currency]="'USD'">
</ngx-braintree>

I am Using AWS Lambda for API for Node.js
My getClientToken() function

gateway.clientToken.generate({}, function (err, response) {
        var clientToken = response.clientToken;

        const res = {
            "headers": {
                'access-control-allow-origin': '*'
            },
            "statusCode": 200,
            "body": JSON.stringify({
                "token": clientToken
            })
        };
    
        callback(null, res);
    });

My purchaseURL() function

gateway.transaction.sale({
        amount: data.amount,
        paymentMethodNonce: data.nonce,
        options: {
          submitForSettlement: true
        }
    },
    function (err, result) {
        console.log('After Trancection');
        console.log(result);

        const res = {
            "headers": {
                'access-control-allow-origin': '*'
            },
            "statusCode": 200,
            "body": JSON.stringify({result})
        };
    
        callback(null, res);
    });

from ngx-braintree.

srikanthonl avatar srikanthonl commented on May 29, 2024

As in documentation, ngx-braintree posts the nonce and the chargeAmount, to the URL you provide, in the following format:
{"nonce":"d7438dd5-7f14-0b2a-7a6f-f3c83d43b5b7","chargeAmount":55.55}

I see that your purchaseURL() function is trying to read the amount as data.amount shouldn't it be data.chargeAmount?

from ngx-braintree.

CodeAnomalies avatar CodeAnomalies commented on May 29, 2024

my mistake on that.
I mistakenly wrote it wrong here, that is correct on my server, that is not an issue as when I pay with drop-in it works, the API is not being called when I pay with Paypal checkout and also the amount of payment is also not displayed on paypal checkout.

Expected
screen shot 2018-05-08 at 4 24 38 pm

Getting
screen shot 2018-05-08 at 4 25 35 pm

As you can see the amount is not being passed to paypal checkout

from ngx-braintree.

srikanthonl avatar srikanthonl commented on May 29, 2024

Well, ngx-braintree has no control on this window. Although it could configure this window to some extent for example, to show shipping address (which it currently is not doing yet), but AFAIK the amount is not displayed for paypal express checkout (the amount might get displayed for other types of paypal integrations but not for Paypal in Braintree DropIn UI). The visit to PayPal window is only to login and its back to your application after logging in where you can (or already are) displaying the amount to charge anyway.

from ngx-braintree.

experionakash avatar experionakash commented on May 29, 2024

@CodeAnomalies how do you fixed this issue

from ngx-braintree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.