Payment with REST API Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Getting strange result querying carts when using multiple search filter groupsThe requested Payment Method is not available When creating an orderHow to return a JSON object with a custom REST API in Magento 2?How do I get Bestseller Product with REST APIMagento 2 REST API placing order with Braintree Credit Card errorGet all simple product with REST APIMagento 2 REST API - Update Payment Methodhow to login with facebook rest apiUpdate Customer data with REST APIMagento2 Get Payment Method API Returns Empty

Why can't fire hurt Daenerys but it did to Jon Snow in season 1?

Marquee sign letters

One-one communication

Why is there so little support for joining EFTA in the British parliament?

Random body shuffle every night—can we still function?

Besides transaction validation, are there any other uses of the Script language in Bitcoin

New Order #6: Easter Egg

How could a hydrazine and N2O4 cloud (or it's reactants) show up in weather radar?

Why not use the yoke to control yaw, as well as pitch and roll?

How to ask rejected full-time candidates to apply to teach individual courses?

Did John Wesley plagiarize Matthew Henry...?

Why are current probes so expensive?

Found this skink in my tomato plant bucket. Is he trapped? Or could he leave if he wanted?

Does the universe have a fixed centre of mass?

Does a random sequence of vectors span a Hilbert space?

Short story about astronauts fertilizing soil with their own bodies

Weaponising the Grasp-at-a-Distance spell

Typical Calculus BC Separation of Variables Question

Does the main washing effect of soap come from foam?

What is a more techy Technical Writer job title that isn't cutesy or confusing?

Can gravitational waves pass through a black hole?

The test team as an enemy of development? And how can this be avoided?

Should man-made satellites feature an intelligent inverted "cow catcher"?

An isoperimetric-type inequality inside a cube



Payment with REST API



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Getting strange result querying carts when using multiple search filter groupsThe requested Payment Method is not available When creating an orderHow to return a JSON object with a custom REST API in Magento 2?How do I get Bestseller Product with REST APIMagento 2 REST API placing order with Braintree Credit Card errorGet all simple product with REST APIMagento 2 REST API - Update Payment Methodhow to login with facebook rest apiUpdate Customer data with REST APIMagento2 Get Payment Method API Returns Empty



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'm using Braintree payment gateway and having issues when tying to make a payment through REST API. I am calling carts/mine/payment-information endpoint with following values.



Header:



Authorization: Bearer customer-token
Content-type: application/json


Body:




"paymentMethod":
"po_number": "",
"method": "braintree",
"additional_data":
"cc_last4":"1111",
"store_in_vault":true,
"payment_method_nonce":"nonce-goes-here",
"cc_token":"",
"device_data":"",
"cc_type":"Visa",
"cc_exp_year":"2055",
"cc_exp_month":"01"
,
"extension_attributes":
"agreement_ids": [
"string"
]

,
"billingAddress":
"id": 0,
"region": "Victoria",
"region_id": 546,
"region_code": "VIC",
"country_id": "AU",
"street": [
"Main St"
],
"company": "Company Name",
"telephone": "987654321",
"fax": "",
"postcode": "3000",
"city": "Melbourne",
"firstname": "Firstname",
"lastname": "Lastname",
"middlename": "Middlename",
"prefix": "Mr",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "name@domain.name",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": ,
"custom_attributes":




I have generated a braintree token and used that token to generate the nonce. With the use of nonce, I was able to create a Braintree transaction as below.



 $result = Braintree_Transaction::sale([
'amount' => $transactionAmount,
'paymentMethodNonce' => $nonceFromTheClient,
'options' => [
'submitForSettlement' => True
]
]);


The transaction gets successful but when I try to place an order on Magento using my transaction details, I keep getting the following error.




Transaction has been declined. Please try again later




Can anyone advise me what's wrong with my process/ request please?



Thanks!










share|improve this question














bumped to the homepage by Community 10 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Could you pass along which version of Magento you're using. Do you have error/exception logging enabled? If so, would you mind posting the error(s) in those logs?

    – drs6222
    Feb 21 '18 at 17:36

















1















I'm using Braintree payment gateway and having issues when tying to make a payment through REST API. I am calling carts/mine/payment-information endpoint with following values.



Header:



Authorization: Bearer customer-token
Content-type: application/json


Body:




"paymentMethod":
"po_number": "",
"method": "braintree",
"additional_data":
"cc_last4":"1111",
"store_in_vault":true,
"payment_method_nonce":"nonce-goes-here",
"cc_token":"",
"device_data":"",
"cc_type":"Visa",
"cc_exp_year":"2055",
"cc_exp_month":"01"
,
"extension_attributes":
"agreement_ids": [
"string"
]

,
"billingAddress":
"id": 0,
"region": "Victoria",
"region_id": 546,
"region_code": "VIC",
"country_id": "AU",
"street": [
"Main St"
],
"company": "Company Name",
"telephone": "987654321",
"fax": "",
"postcode": "3000",
"city": "Melbourne",
"firstname": "Firstname",
"lastname": "Lastname",
"middlename": "Middlename",
"prefix": "Mr",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "name@domain.name",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": ,
"custom_attributes":




I have generated a braintree token and used that token to generate the nonce. With the use of nonce, I was able to create a Braintree transaction as below.



 $result = Braintree_Transaction::sale([
'amount' => $transactionAmount,
'paymentMethodNonce' => $nonceFromTheClient,
'options' => [
'submitForSettlement' => True
]
]);


The transaction gets successful but when I try to place an order on Magento using my transaction details, I keep getting the following error.




Transaction has been declined. Please try again later




Can anyone advise me what's wrong with my process/ request please?



Thanks!










share|improve this question














bumped to the homepage by Community 10 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Could you pass along which version of Magento you're using. Do you have error/exception logging enabled? If so, would you mind posting the error(s) in those logs?

    – drs6222
    Feb 21 '18 at 17:36













1












1








1


1






I'm using Braintree payment gateway and having issues when tying to make a payment through REST API. I am calling carts/mine/payment-information endpoint with following values.



Header:



Authorization: Bearer customer-token
Content-type: application/json


Body:




"paymentMethod":
"po_number": "",
"method": "braintree",
"additional_data":
"cc_last4":"1111",
"store_in_vault":true,
"payment_method_nonce":"nonce-goes-here",
"cc_token":"",
"device_data":"",
"cc_type":"Visa",
"cc_exp_year":"2055",
"cc_exp_month":"01"
,
"extension_attributes":
"agreement_ids": [
"string"
]

,
"billingAddress":
"id": 0,
"region": "Victoria",
"region_id": 546,
"region_code": "VIC",
"country_id": "AU",
"street": [
"Main St"
],
"company": "Company Name",
"telephone": "987654321",
"fax": "",
"postcode": "3000",
"city": "Melbourne",
"firstname": "Firstname",
"lastname": "Lastname",
"middlename": "Middlename",
"prefix": "Mr",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "name@domain.name",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": ,
"custom_attributes":




I have generated a braintree token and used that token to generate the nonce. With the use of nonce, I was able to create a Braintree transaction as below.



 $result = Braintree_Transaction::sale([
'amount' => $transactionAmount,
'paymentMethodNonce' => $nonceFromTheClient,
'options' => [
'submitForSettlement' => True
]
]);


The transaction gets successful but when I try to place an order on Magento using my transaction details, I keep getting the following error.




Transaction has been declined. Please try again later




Can anyone advise me what's wrong with my process/ request please?



Thanks!










share|improve this question














I'm using Braintree payment gateway and having issues when tying to make a payment through REST API. I am calling carts/mine/payment-information endpoint with following values.



Header:



Authorization: Bearer customer-token
Content-type: application/json


Body:




"paymentMethod":
"po_number": "",
"method": "braintree",
"additional_data":
"cc_last4":"1111",
"store_in_vault":true,
"payment_method_nonce":"nonce-goes-here",
"cc_token":"",
"device_data":"",
"cc_type":"Visa",
"cc_exp_year":"2055",
"cc_exp_month":"01"
,
"extension_attributes":
"agreement_ids": [
"string"
]

,
"billingAddress":
"id": 0,
"region": "Victoria",
"region_id": 546,
"region_code": "VIC",
"country_id": "AU",
"street": [
"Main St"
],
"company": "Company Name",
"telephone": "987654321",
"fax": "",
"postcode": "3000",
"city": "Melbourne",
"firstname": "Firstname",
"lastname": "Lastname",
"middlename": "Middlename",
"prefix": "Mr",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "name@domain.name",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": ,
"custom_attributes":




I have generated a braintree token and used that token to generate the nonce. With the use of nonce, I was able to create a Braintree transaction as below.



 $result = Braintree_Transaction::sale([
'amount' => $transactionAmount,
'paymentMethodNonce' => $nonceFromTheClient,
'options' => [
'submitForSettlement' => True
]
]);


The transaction gets successful but when I try to place an order on Magento using my transaction details, I keep getting the following error.




Transaction has been declined. Please try again later




Can anyone advise me what's wrong with my process/ request please?



Thanks!







magento2 payment-methods rest-api braintree






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 14 '18 at 5:12









shakpitshakpit

263




263





bumped to the homepage by Community 10 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 10 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Could you pass along which version of Magento you're using. Do you have error/exception logging enabled? If so, would you mind posting the error(s) in those logs?

    – drs6222
    Feb 21 '18 at 17:36

















  • Could you pass along which version of Magento you're using. Do you have error/exception logging enabled? If so, would you mind posting the error(s) in those logs?

    – drs6222
    Feb 21 '18 at 17:36
















Could you pass along which version of Magento you're using. Do you have error/exception logging enabled? If so, would you mind posting the error(s) in those logs?

– drs6222
Feb 21 '18 at 17:36





Could you pass along which version of Magento you're using. Do you have error/exception logging enabled? If so, would you mind posting the error(s) in those logs?

– drs6222
Feb 21 '18 at 17:36










1 Answer
1






active

oldest

votes


















0














Here how Braintree integration looks like (https://developers.braintreepayments.com/start/overview)
enter image description here



So you need do the following



1) Get client token from Magento server. I didn't find rest endpoint for it so I've created a custom extension for this purpose (https://github.com/troublediehard/mma-customapi)



2) Then use sdk and token to get nonce from you card



3) And send your request with nonce data like this




paymentMethod:
method: 'braintree',
additional_data:
payment_method_nonce: nonce,








share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f213397%2fpayment-with-rest-api%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Here how Braintree integration looks like (https://developers.braintreepayments.com/start/overview)
    enter image description here



    So you need do the following



    1) Get client token from Magento server. I didn't find rest endpoint for it so I've created a custom extension for this purpose (https://github.com/troublediehard/mma-customapi)



    2) Then use sdk and token to get nonce from you card



    3) And send your request with nonce data like this




    paymentMethod:
    method: 'braintree',
    additional_data:
    payment_method_nonce: nonce,








    share|improve this answer



























      0














      Here how Braintree integration looks like (https://developers.braintreepayments.com/start/overview)
      enter image description here



      So you need do the following



      1) Get client token from Magento server. I didn't find rest endpoint for it so I've created a custom extension for this purpose (https://github.com/troublediehard/mma-customapi)



      2) Then use sdk and token to get nonce from you card



      3) And send your request with nonce data like this




      paymentMethod:
      method: 'braintree',
      additional_data:
      payment_method_nonce: nonce,








      share|improve this answer

























        0












        0








        0







        Here how Braintree integration looks like (https://developers.braintreepayments.com/start/overview)
        enter image description here



        So you need do the following



        1) Get client token from Magento server. I didn't find rest endpoint for it so I've created a custom extension for this purpose (https://github.com/troublediehard/mma-customapi)



        2) Then use sdk and token to get nonce from you card



        3) And send your request with nonce data like this




        paymentMethod:
        method: 'braintree',
        additional_data:
        payment_method_nonce: nonce,








        share|improve this answer













        Here how Braintree integration looks like (https://developers.braintreepayments.com/start/overview)
        enter image description here



        So you need do the following



        1) Get client token from Magento server. I didn't find rest endpoint for it so I've created a custom extension for this purpose (https://github.com/troublediehard/mma-customapi)



        2) Then use sdk and token to get nonce from you card



        3) And send your request with nonce data like this




        paymentMethod:
        method: 'braintree',
        additional_data:
        payment_method_nonce: nonce,









        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 26 '18 at 21:59









        Dmitri PortenkoDmitri Portenko

        474315




        474315



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f213397%2fpayment-with-rest-api%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

            Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

            How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2