2
私はペイメントゲートウェイインテグレーションを初めて導入しました。Braintree Payment Gateway
をJSFアプリケーションと統合する必要があります。誰かが私のJavaクラスとサンプルの支払いページの私の基本的な例を示すことができます。私はそれを生成する方法をいくつかのクライアントトークンを見た。私は以下のようなサンプルクラスとページを書いたが、私はアイデアを得ることができないので、私はクーデントを作る。BraintreeペイメントゲートウェイとJavaの統合について
ページ
<form id="checkout" method="post" action="/checkout">
<div id="payment-form"></div>
<input type="submit" value="Pay $15">
</form>
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
<script>
// We generated a client token for you so you can test out this code
// immediately. In a production-ready integration, you will need to
// generate a client token on your server (see section below).
var clientToken = "sZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0=";
braintree.setup(clientToken, "dropin", {
container : "payment-form"
});
</script>
クラス
import spark.Request;
import spark.Response;
import spark.Route;
import com.braintreegateway.BraintreeGateway;
import com.braintreegateway.Environment;
public class BrainTreeController {
private static BraintreeGateway gateway = new BraintreeGateway(
Environment.SANDBOX,
"your_merchant_id",
"your_public_key",
"your_private_key"
);
post(new Route("/client_token") {
@Override
public Object handle(Request request, Response response) {
return gateway.clientToken().generate();
}
});
}
私はポスト
Syntax error on token "post", @ expected before this token
どのようにすれば購読するのですか@ckpatel i Tried PaymentMethod paymentmethod = generatePaymentMethod( "31558878"); \t \t \t \t SubscriptionRequest subscribtionrequest = new SubscriptionRequest(); \t \t \t \t \t \t .paymentMethodToken(paymentmethod.getToken()) \t \t \t \t \t \t .ID( "Subsc31558878")。PLANID(plan.getId()) \t \t \t \t \t \t .paymentMethodNonce(receivePaymentMethodNonce ()) \t \t \t \t .neverExpires(false).billingDayOfMonth(30) \t \t \t \t \t \t .firstBillingDate(日付).price(plan.getPrice())アドオン() \t \t \t \t \t \tの.done()。結果<サブスクリプション> subscresult = gateway.subscription() \t \t \t \t \t \t .create(subscribtionrequest); –