cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

the currency of this PayPal transaction must match the currency of the merchant account

vikasfour
New Community Member

Logs

{"code":1,"res":{"errors":{},"params":{"transaction":{"type":"sale","amount":"6.000000","paymentMethodNonce":"5635e3f4-e1c4-0a73-8016-f6ea5e6d9ccb","options":{"submitForSettlement":"true"}}},"message":"The currency of this PayPal transaction must match the currency of the merchant account","transaction":{"id":"n5bwcmhb","status":"processor_declined","type":"sale","currencyIsoCode":"INR","amount":"6.00","merchantAccountId":"INR","subMerchantAccountId":null,"

Clients Side Code :

                  setTimeout(function(){
                  // Render the PayPal button
                  //console.log($('#paytmToken').val());
                  paypal.Button.render({

                      // Pass in the Braintree SDK
                      braintree: braintree,
                     // Pass in your Braintree authorization key
                     client: {
                        production: $('#Token').val(),
                      //    sandbox : $('#Token').val(),
                          //sandbox: '<?php echo $token ?>'
                      },

                      // Set your environment

                      env: 'production', // sandbox | production
                    //  env: 'sandbox',
                      // Wait for the PayPal button to be clicked

                      payment: function(data, actions) {

                          // Make a call to create the payment

                          var data1=actions.braintree.create({
                              flow: 'checkout', // Required
                              amount: $('#paypal_total').val(), // Required
                              currency: 'USD', // Required
                          });

                  return data1;
                      },

                      // Wait for the payment to be authorized by the customer

                      onAuthorize: function(data, actions) {
                          console.log("wow",data.paymentID);
                  return actions.payment.tokenize().then(function(data) {
                              console.log('Braintree nonce:', data);
                              console.log('Braintree nonce:', data.nonce);
                              $("#paypal-button-container").html("Please wait, do not close and refresh the window...");
                              var order_id = $('#order_id').val();
                              angular.element($("#mainDivCall")).scope().completePayPalOrder(data,order_id);
                          });
                      }

                  }, '#paypal-button-container');
                },1000);
              

Server Side Code :   Generate Token

$clientToken = $gateway->clientToken()->generate();
$res = array("code"=>1, "token"=>$clientToken);
echo json_encode($res);

Checkout

$nonce = $_POST['nonce'];
$amount = $_POST['amount'];
$result = $gateway->transaction()->sale([
  'amount' => $amount,
  'paymentMethodNonce' => $nonce,
  'options' => [
    'submitForSettlement' => True
  ]
]);


             

 

Login to Me Too
Who Me Too'd this topic