Closed lse123 closed 7 years ago
Users can pay via credit card, Apple Pay, or Pay Pal account. You need a Braintree registration first to make this plugin work. Not other application needed on client. Check the docs here: https://developers.braintreepayments.com
so the plugin tested and work and also work in Intel XDK (Cordova Cross-Over Apps), correct???
This plugin is provided AS IS without warranty of any kind. You have to test with your code and your environment. The plugin is works for me in an cordova based product on both android and ios.
OK so this cordova plugin works and with sandbox keys... like samples web repos on github like https://github.com/braintree/braintree_php_example https://developers.braintreepayments.com/start/hello-server/php
that work... with sandbox keys and sample credit cards like 4000 0000 0000 0001 ? Or I have to use Prod keys initially?
I used sandbox token
if (result.userCancelled) { // 52 line
console.debug("User cancelled payment dialog.");
}
I run in xdk emulator Not real emulator Android... and getting... // any hint? I have to run in real device...? init OK! Uncaught TypeError: Cannot read property 'userCancelled' of undefined index.html?1488208205142:52(anonymous function) index.html?1488208205142:52(anonymous function) app-host.js:136Emitter.emit socket.io.js:4Socket.onevent socket.io.js:4Socket.onpacket socket.io.js:4(anonymous function) socket.io.js:4Emitter.emit socket.io.js:4Manager.ondecoded socket.io.js:3(anonymous function) socket.io.js:4Emitter.emit socket.io.js:3Decoder.add socket.io.js:4Manager.ondata socket.io.js:3(anonymous function) socket.io.js:4Emitter.emit socket.io.js:3Socket.onPacket socket.io.js:2(anonymous function) socket.io.js:2Emitter.emit socket.io.js:3Transport.onPacket socket.io.js:2Transport.onData socket.io.js:2ws.onmessage socket.io.js:2
Please post the full code. The error log you have copied means result is undefined. If you use it in BraintreePlugin.presentDropInPaymentUI(options, function (result) { } );
that means result is not passed (which is a bug but i need much more info to solve this)
I just a moment post it await please
<body>
<p>Hello, Cordova!</p>
<button onclick="runFunc();">BraintreePlugin.presentDropInPaymentUI</button>
<script>
function runFunc() {
var token = "xxxxxx";
BraintreePlugin.initialize(token,
function () { console.log("init OK!"); },
function (error) { console.error(error); });
var options = {
amount: "49.99",
primaryDescription: "Your Item"
};
BraintreePlugin.presentDropInPaymentUI(options, function (result) {
if (result.userCancelled) {
console.debug("User cancelled payment dialog.");
}
else {
console.info("User completed payment dialog.");
console.info("Payment Nonce: " + result.nonce);
console.debug("Payment Result.", result);
}
});
}
</script>
</body>
</html>
Try this:
function runFunc() {
var token = "xxxxxx";
BraintreePlugin.initialize(token,
function () {
console.log("init OK!");
var options = {
amount: "49.99",
primaryDescription: "Your Item"
};
BraintreePlugin.presentDropInPaymentUI(options, function (result) {
if (result.userCancelled) {
console.debug("User cancelled payment dialog.");
}
else {
console.info("User completed payment dialog.");
console.info("Payment Nonce: " + result.nonce);
console.debug("Payment Result.", result);
}
});
},
function (error) {
console.error(error);
});
}
again error // may token error var token = "sandbox<8 chars><16 chars>"; // is it this...?
BraintreePlugin.presentDropInPaymentUI(options, function (result) {
if (result.userCancelled) { // line 72
console.debug("User cancelled payment dialog.");
}
Uncaught TypeError: Cannot read property 'userCancelled' of undefined index.html?1488287646361:72
(anonymous function) index.html?1488287646361:72(anonymous function) app-host.js:136Emitter.emit socket.io.js:4Socket.onevent socket.io.js:4Socket.onpacket socket.io.js:4(anonymous function) socket.io.js:4Emitter.emit socket.io.js:4Manager.ondecoded socket.io.js:3(anonymous function) socket.io.js:4Emitter.emit socket.io.js:3Decoder.add socket.io.js:4Manager.ondata socket.io.js:3(anonymous function) socket.io.js:4Emitter.emit socket.io.js:3Socket.onPacket socket.io.js:2(anonymous function) socket.io.js:2Emitter.emit socket.io.js:3Transport.onPacket socket.io.js:2Transport.onData socket.io.js:2ws.onmessage socket.io.js:2
The XDK emulator has several limitations with Cordova plugins read more here: https://software.intel.com/en-us/xdk/articles/unimplemented-cordova-api-device-emulator I suggest you to try it on a real android emulator or on a device.
code should work... what success reply must get? token is correct? so if in real device i must put alerts rather console logs correct?
Please read Braintree docs. Once the payment approved by the user your mobile app should post the payment nonce to your server and then your server should settle the transaction via Braintree gatway. https://developers.braintreepayments.com/start/hello-client/android/v2
I got error during build plugin cannot added in XDK... well?
Intel XDK doesn't support Gradle script for plugins. Consider using Cordova instead of XDK. See more here: https://software.intel.com/en-us/forums/intel-xdk-iot-edition/topic/605952
This Plugin if installed in my Android and iOS App --- what required from Users to pay eg 5$...? Must have Braintree Android App... or there is Not such Must pay with PayPal or Google Pay? How they are logged in to Braintree... mut have apps of PayPal or Google Pay or completed in the mobile browser?