lib 1400447 // stripe lib 1400448 // gson import com.stripe.Stripe; import com.stripe.model.checkout.Session; import com.stripe.param.checkout.SessionCreateParams; cmodule StripeTest > DynPrintLog { set flag NoNanoHTTPD. !include #1029545 // API for Eleu transient S YOUR_DOMAIN = "https://stripe-test.botcompany.de"; transient S apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; O html(IWebRequest req) ctex { // This is a sample test API key. Sign in to see examples pre-filled with your key. Stripe.apiKey = apiKey; if (eq(req.uri(), "/create-checkout-session")) { SessionCreateParams params = SessionCreateParams.builder() .addPaymentMethodType(SessionCreateParams.PaymentMethodType.CARD) .setMode(SessionCreateParams.Mode.PAYMENT) .setSuccessUrl(YOUR_DOMAIN + "/success.html") .setCancelUrl(YOUR_DOMAIN + "/cancel.html") .addLineItem( SessionCreateParams.LineItem.builder() .setQuantity(1L) .setPriceData( SessionCreateParams.LineItem.PriceData.builder() .setCurrency("usd") .setUnitAmount(2000L) .setProductData( SessionCreateParams.LineItem.PriceData.ProductData.builder() .setName("Stubborn Attachments") .build()) .build()) .build()) .build(); Session session = Session.create(params); SS responseData = litmap(id := session.getId()); ret subBot_serveJSON(responseData); } if (eq(req.uri(), "/")) ret [[ Buy cool new product
The cover of Stubborn Attachments

Stubborn Attachments

$20.00
]]; if (eq(req.uri(), "/success.html")) ret [[ Thanks for your order!

We appreciate your business! If you have any questions, please email orders@example.com.

]]; if (eq(req.uri(), "/cancel.html")) ret [[ Checkout canceled

Forgot to add something to your cart? Shop around then come back to pay!

]]; null; } }