#baller
1 messages · Page 1 of 1 (latest)
Hello! Not sure I understand, can you provide more details?
This is my backend code
def post(self, request, *args, **kwargs):
payment_type = request.data.get('payment_type', '')
from_account = request.data.get('from_account', '')
to_account = request.data.get('to_account', '')
amount = request.data.get('amount', '')
product_id = request.data.get('product_id', '')
price = stripe.Price.search(query=f"active:'true' AND product:'{product_id}'").data[0]
if not price.unit_amount:
price.unit_amount = int(amount)
success_url = request.data.get('success_url', '')
cancel_url = request.data.get('cancel_url', '')
dest_acc = get_object_or_404(UserProfile, pk=to_account)
platform_fee_amount = math.floor(PLATFORM_FEE * price.unit_amount)
checkout_session = stripe.checkout.Session.create(
mode=f"{payment_type}",
line_items=[{"price": price.id, "quantity": 1}],
payment_intent_data={
"transfer_data": {"amount": price.unit_amount-platform_fee_amount, "destination": dest_acc.wallet.account_id}
},
success_url=success_url,
cancel_url=cancel_url,
metadata={"from_account": from_account, "to_account": to_account, "amount": price.unit_amount, "payment_type": payment_type}
)
return JsonResponse(checkout_session)
I made a product where the pricing model is customer chooses price, but the issue is I need to know the price before creating the checkout session. since I need to calculate how much to give to the connected account
Is there a way to pass in the amount or price to the checkout page?
If you want to set the price to something specific why are you letting your customer define a custom price?
hmm you're right, it should not let customer choose price
Is there a way to set the price through API
do I have to create a new price object and set the price that way?
because the price is displayed on checkout page with line_items=[{"price": price.id, "quantity": 1}],
so does this mean everytime we enter a different amount a new price must be created?
In short, yes. But you can specify price_data to create an ad-hoc Price inline when creating the Checkout Session instead of separately creating a Price each time: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
Thanks for the reply
Also i had another question
We are creating a destination charge for a connected acount in a different region than us. Can we be the settlement merchant because we don't want "the connected account’s address and phone number are displayed on the customer’s credit card statement." Our connected accounts are individuals and would not want their address and number public.
Also "If on_behalf_of is omitted, the platform is the business of record for the payment." but in another sentence it says "For cross-region support, you must specify the settlement merchant to the connected account"
Hello, apologies for the delay, the server is getting pretty busy. OBO is the thing that changes who the settlement merchant is, so making these payments without OBO would be the way to keep yourself as the settlement merchant.
Broadly what region are you in vs your users? I thought you could do cross-border destination charges without OBO. Can double check what is possible for your situation.
we are located in Canada, and most of our users will be in Europe and US
Right now I'm doing without OBO cross border and I'm getting an error, the connected account is in US and platform is in CA
Gotcha, so it sounds like you do need to need to use OBO to make payments and unfortunately that does mean that the user's support info would get sent to the bank as they would be the merchant of record.
It might be worth asking our support team if there are other options for making these payments while remaining the merchant of record. They will know a bit more about policy than I do, so there may be some configuration that can be made on your account for this. I can't guaruntee that they will have something for you but I think it would be worth asking
Thanks!
yeah, ideally it would be nice to just have our platform be the merchant of all payments globally
how do I contact the support team?
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.