Need to integrate laravel/cashier-braintree in my Laravel app. Having pretty much no experience with Braintree integration it's really hard to make it work. Can somebody explain in steps how it works, or some tutorial that would be good for this? Tried to follow integration for Stripe, cause they are similar but no success.
This is how my code looks like right now
Intergraded oureastudios/laravel5-braintree so then in console form-data I get payment_method_nounce correctly, but how do I pass client token to my checkout method?
<form id="checkout" action="{{ url('subscriptions/checkout') }}" method="post">
{{ csrf_field() }}
<div class="form-group">
<label for="">Choose option:</label>
<select name="plan" id="plan" class="form-control">
<option value="small">Small ($5/month)</option>
<option value="large">Large ($10/month)</option>
</select>
</div>
<div class="form-group">
<div id="number" class="form-control"></div>
</div>
<div class="form-group">
<div id="expiration-date" class="form-control"></div>
</div>
<div class="form-group">
<div id="cvv" class="form-control"></div>
</div>
<input type="submit" id="submit" value="Pay">
</form>
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
<script>
var colorTransition = 'color 100ms ease-out';
braintree.setup("@braintreeClientToken", "custom", {
id: "checkout",
hostedFields: {
styles: {
// Style all elements
"input": {
"color": "#333"
},
// Styling element state
":focus": {
"color": "blue"
},
".valid": {
"color": "green"
},
".invalid": {
"color": "red"
},
// Media queries
// Note that these apply to the iframe, not the root window.
"@media screen and (max-width: 700px)": {
"input": {}
}
},
number: {
selector: "#number"
},
expirationDate: {
selector: "#expiration-date"
},
cvv: {
selector: "#cvv"
}
}
});
</script>
On checkout method getting
Unable to create Braintree customer: Unknown payment_method_nonce.
Expiration date is required.
Credit card number is required.
Credit card must include number, payment_method_nonce, or venmo_sdk_payment_method_code.
Don't know how to pass @braintreeClientToken in checkout method..
Maybe someone knows how to make this working?