#Atish
1 messages ยท Page 1 of 1 (latest)
Which integration type do you use? Checkout Session, Payment Element with Payment Intent, Invoice... etc?
It's not necessary to create price object. You can create ad-hoc pricing using line_items.price_data at the time during Checkout Session creation: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
List<Object> lineItems = new ArrayList<>();
Map<String, Object> lineItem1 = new HashMap<>();
lineItem1.put("price", "price_H5ggYwtDq4fbrJ");
lineItem1.put("quantity", 2);
lineItems.add(line_item1);
Map<String, Object> params = new HashMap<>();
params.put(
"success_url",
"https://example.com/success"
);
params.put("line_items", lineItems);
params.put("mode", "payment");
Session session = Session.create(params);```
Is there similar example using price_data?
Please do not share secret key in this public channel as it's visible for everyone ๐
Yes! You may refer to the sample Checkout Checkout Session creation request here: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#redirect-customers
More specifically:
SessionCreateParams params =
SessionCreateParams.builder()
.setMode(SessionCreateParams.Mode.PAYMENT)
.setSuccessUrl("http://localhost:4242/success")
.setCancelUrl("http://localhost:4242/cancel")
.addLineItem(
SessionCreateParams.LineItem.builder()
.setQuantity(1L)
.setPriceData(
SessionCreateParams.LineItem.PriceData.builder()
.setCurrency("usd")
.setUnitAmount(2000L)
.setProductData(
SessionCreateParams.LineItem.PriceData.ProductData.builder()
.setName("T-shirt")
.build())
.build())
.build())
.build();
Session session = Session.create(params);
thank you so much, let me try
No problem! Happy to help ๐
I'd recommend removing your secret key in the above code
That was the code from documentation, it was not my secret key
I just created a payment, it was successful and the seller got his amount in test mode
But the platform fee was not received.
๐ taking over here
Let's start debugging. Can you find your request id req_xxx in https://dashboard.stripe.com/test/logs ?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
@RestController
class PaymentController {
@Value("\${stripe.apikey}")
lateinit var stripeApiKey: String
@PostMapping("/create-checkout-session")
fun createCheckoutSession(): Map<String, Any> {
Stripe.apiKey = stripeApiKey
val params = SessionCreateParams.builder()
.setMode(SessionCreateParams.Mode.PAYMENT)
.setSuccessUrl("http://localhost:4242/success")
.setCancelUrl("http://localhost:4242/cancel")
.addLineItem(
SessionCreateParams.LineItem.builder()
.setQuantity(1L)
.setPriceData(
SessionCreateParams.LineItem.PriceData.builder()
.setCurrency("usd")
.setUnitAmount(3456L)
.setProductData(
SessionCreateParams.LineItem.PriceData.ProductData.builder()
.setName("T-shirt")
.build())
.build())
.build())
.setPaymentIntentData(
SessionCreateParams.PaymentIntentData.builder()
.setApplicationFeeAmount(123L)
.setTransferData(
SessionCreateParams.PaymentIntentData.TransferData.builder()
.setDestination("acct_1MYl6BRfEAHzyOVs")
.build()
)
.build()
)
.build()
val session = Session.create(params)
val responseData = mutableMapOf<String, Any>()
responseData.put("redirectUrl", session.url)
return responseData
}
}
No I meant request log on your Dashboard
You would want to find the Payment Intent Id first pi_xxx
I paid 34.56 here, and received 31.56
Then view on Dashboard, it will give a details page
This is your Platform account correct? You can check the Payments tab and find the payment
I am a bit confused, I need to set two things, one apiKey and another destination account ID
I provided the destination account ID and the amount is transferred to that account
Where I can specify the account for the platform fee?
the key you are using is already defining the Platform account.
On your request if you have application_fee_amount then you are collecting that part
Check this Doc for fund flows https://stripe.com/docs/connect/destination-charges
Sorry to ask these stupid questions. But in my case acct_1MYkJlDfJAkpzIQT, is this my platform account?
In that screen? No it should be the Connected Account
Where can I view my platform account?
Your account id should be listed here https://dashboard.stripe.com/settings/user (Accounts section)
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You mean this last one? Is this my platform account?
How can I view the balance in that account
All my collected fees should have been deposited here right? But I don't see any amount here
I got it thank you
So I can transfer to the connected accounts only?
When I need to send it to seller stripe account
You already using destination charge, you should have sent some amount to your connected account if you are using the application_fee_amount mentioned above
So using the destination charge we can pay to the connected accounts only right? Is there any other methods of receiving payments?
For example in cardano we have a unique address and anyone can pay me using that address
Yes you can only pay to the Connected Account specified in the Destination Charge call
(Please read the fund flow Doc above)
This means all sellers must have a connected account in my account