#papazov9_code

1 messages ยท Page 1 of 1 (latest)

untold jasperBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1303358077776695296

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

vagrant zenith
#

hello

magic gull
vagrant zenith
#

I am attaching what cannot be send
PaymentIntentCreateParams.PaymentMethodOptions paymentMethodOptions =
PaymentIntentCreateParams.PaymentMethodOptions.builder()
.setCustomerBalance(customerBalanceOptions)
.build();

// Build PaymentIntentCreateParams with customer_balance
PaymentIntentCreateParams params = PaymentIntentCreateParams.builder()
        .setAmount(paymentSessionRequest.price()) // Stripe expects the amount in the smallest currency unit
        .setCurrency("eur")
        .setCustomer(stripeCustomerId)
        .addPaymentMethodType(PaymentIntentCreateParams.PaymentMethodType.CUSTOMER_BALANCE) // Use enum instead of raw string
        .setPaymentMethodOptions(paymentMethodOptions) // Set the customer_balance options
        .build();

// Create the PaymentIntent
PaymentIntent paymentIntent = PaymentIntent.create(params);
vagrant zenith
# magic gull hi there! what docs did you read that said to call the API that way? https://do...

i first try the way docs are but there is nothing specific abot bank transfer but only this:
PaymentIntentCreateParams params =
PaymentIntentCreateParams.builder()
.setCustomer
("{{CUSTOMER_ID}}"
)
.setAmount
(1099L)
.setCurrency
("bgn")
.setSetupFutureUsage
(PaymentIntentCreateParams.SetupFutureUsage.OFF_SESSION)
.setAutomaticPaymentMethods
(
PaymentIntentCreateParams.AutomaticPaymentMethods.builder().setEnabled
(true).build()
)
.build();

#

and afterwards start searching and combining some ways

#

i will take a look at this docs a

magic gull
#

sounds good, I'd recommend using the guide in the docs yep!

vagrant zenith
#

sure but is there a guid for java

#

guide*

magic gull
#

yep, the page I linked has Java snippets(make sure to adjust the language in the top-right of the snippets)

vagrant zenith
#

com.stripe.exception.InvalidRequestException: The PaymentMethod provided (customer_balance) is not allowed for this PaymentIntent. Please attach a PaymentMethod of one of the following types: card. Alternatively, update the allowed payment_method_types for this PaymentIntent to include "customer_balance".; request-id: req_DNWUSyXd1rg7bP

i implmented it as in the exampel and received this

magic gull
#

that is not as per the example.

#

ah sorry, it is. Let me look deeper..

vagrant zenith
#

exactly the same:
PaymentIntentCreateParams params = PaymentIntentCreateParams
.builder()
.setAmount(paymentSessionRequest.price())
.setCustomer(stripeCustomerId)
.setCurrency("eur")
.setAutomaticPaymentMethods(
PaymentIntentCreateParams.AutomaticPaymentMethods
.builder()
.setEnabled(true)
.build())
.setReturnUrl("http://localhost:4200/payment-pending")
.setPaymentMethodData(PaymentIntentCreateParams.PaymentMethodData.builder()
.setType(PaymentIntentCreateParams.PaymentMethodData.Type.CUSTOMER_BALANCE)
.build())
.setConfirm(true)
.build();

    PaymentIntent paymentIntent = PaymentIntent.create(params);
magic gull
#

does it work if you remove setAutomaticPaymentMethods(...) and instead do setPaymentMethodTypes() with a List of "customer_balance" ?

vagrant zenith
#

i am trying it rn

#

com.stripe.exception.InvalidRequestException: No such PaymentMethod: 'customer_balance'; code: resource_missing; request-id: req_UERWtfZ6sQXU0R

there is no setPaymentMethodTypes but jsut setPaymentMethod

#

PaymentIntentCreateParams params = PaymentIntentCreateParams
.builder()
.setAmount(paymentSessionRequest.price())
.setCustomer(stripeCustomerId)
.setCurrency("eur")
.setPaymentMethod("customer_balance")
.setReturnUrl("http://localhost:4200/payment-pending")
.setPaymentMethodData(PaymentIntentCreateParams.PaymentMethodData.builder()
.setType(PaymentIntentCreateParams.PaymentMethodData.Type.CUSTOMER_BALANCE)
.build())
.build();

magic gull
#

no, you misread me

#

I said setPaymentMethodTypes not setPaymentMethod

vagrant zenith
#

yes there is no such thing like setPaymentMethodTypes

magic gull
#

ah yeah we removed that from the SDK, great...

vagrant zenith
#

is this the only way of doing bank transfer in eu

magic gull
#

in that case

PaymentIntentCreateParams
                        .builder().putExtraParam("payment_method_types[0]", "customer_balance")
...
vagrant zenith
#

and if so can you explain to me how exactly this customer balance works

#

PaymentIntentCreateParams params = PaymentIntentCreateParams
.builder()
.setAmount(paymentSessionRequest.price())
.setCustomer(stripeCustomerId)
.setCurrency("eur")
.putExtraParam("payment_method_types[0]", "customer_balance")
.setPaymentMethodData(PaymentIntentCreateParams.PaymentMethodData.builder()
.setType(PaymentIntentCreateParams.PaymentMethodData.Type.CUSTOMER_BALANCE)
.build())
.build();

sure this succeed creating a payment intent but now i have this logic where i get the iban from the payment intent or at least try and now it is skipped because there is no next action

if (paymentIntent.getNextAction() != null && paymentIntent.getNextAction().getDisplayBankTransferInstructions() != null) {
String iban = getIban(paymentIntent);
File file = PDFWriterUtil.generateProFormaInvoicePDF(paymentSessionRequest, iban);
String body = "Dear Customer,\n\nPlease find attached your pro forma invoice. " + "Kindly complete the bank transfer to the provided IBAN to proceed with your order.\n\n" + "Thank you,\nUnparalleled Team.";

        this.emailService.sendEmail(paymentSessionRequest.contactEmail(), "Payment details", body, file);
    }
#

can you explain it to me how this should be done in a way that works with pro forma invocie which will be send to the customer which to send money to the given iban and we create a invoice for a succesful payment

magic gull
#

there's no next_action because you didn't pass setConfirm(true) when creating the PaymentIntent

vagrant zenith
#

thanks

untold jasperBOT
vagrant zenith
#

com.stripe.exception.CardException: The customer balance is insufficient to complete the payment. Please change the amount or provide the funding_type parameter.; code: ; request-id: req_ESBriPF8C093o4

i want each transaction to be through the cutomer's desired bank , which i think we haev to funding type or i do not understand the way how customer balance is working can someone explain it to me

#

PaymentIntentCreateParams params = PaymentIntentCreateParams
.builder()
.setAmount(paymentSessionRequest.price())
.setCustomer(stripeCustomerId)
.setCurrency("eur")
.putExtraParam("payment_method_types[0]", "customer_balance")
.setReturnUrl("http://localhost:4200/payment-pending")
.setPaymentMethodData(PaymentIntentCreateParams.PaymentMethodData.builder()
.setType(PaymentIntentCreateParams.PaymentMethodData.Type.CUSTOMER_BALANCE)
.build())
.setConfirm(true)
.build();

    PaymentIntent paymentIntent = PaymentIntent.create(params);
#

this is the config which throws exception

#

hello?

tardy kite
#

Hey there, just stepping in as karllekko had to step away, give me a few minutes to review

vagrant zenith
#

sure. sorry

tardy kite
#

Specifically, you're not including any of these details:

.setPaymentMethodOptions(
      PaymentIntentCreateParams.PaymentMethodOptions.builder()
        .setCustomerBalance(
          PaymentIntentCreateParams.PaymentMethodOptions.CustomerBalance.builder()
            .setFundingType(
              PaymentIntentCreateParams.PaymentMethodOptions.CustomerBalance.FundingType.BANK_TRANSFER
            )
            .setBankTransfer(
              PaymentIntentCreateParams.PaymentMethodOptions.CustomerBalance.BankTransfer.builder()
                .setType(
                  PaymentIntentCreateParams.PaymentMethodOptions.CustomerBalance.BankTransfer.Type.US_BANK_TRANSFER
                )
                .build()
            )
            .build()
        )
        .build()
    )
vagrant zenith
#

i assume if i am working with eur and am in eu instead of US_BANK_TRANSFER i can use EURO_BANK_TRANSFER

#

EU*

#

.putExtraParam("payment_method_types[0]", "customer_balance") adn does this still has to be put

tardy kite
#

Yes, EU for eur bank transfers. Sorry, meant to switch to that based on your request

#

Whether you specify types manualy or using automatic payment methods is up to you

#

The docs show both approaches

vagrant zenith
#

com.stripe.exception.InvalidRequestException: Missing required param: payment_method_options[customer_balance][bank_transfer][eu_bank_transfer].; code: parameter_missing; request-id: req_5GMIkKadvh0akJ

received this error

#

everything seems as the one you sent

tardy kite
#

Switch to the EU tab in the docs

#

You need to include another detail for EU to specify customer country

#
eu_bank_transfer: {
          country: 'FR',
        },

or

.setBankTransfer(
              PaymentIntentCreateParams.PaymentMethodOptions.CustomerBalance.BankTransfer.builder()
                .setType(
                  PaymentIntentCreateParams.PaymentMethodOptions.CustomerBalance.BankTransfer.Type.EU_BANK_TRANSFER
                )
                .setEuBankTransfer(
                  PaymentIntentCreateParams.PaymentMethodOptions.CustomerBalance.BankTransfer.EuBankTransfer.builder()
                    .setCountry("FR") /// <------ THIS
                    .build()
                )
                .build()
            )
            .build()
vagrant zenith
#

sure

#

sure so maybe we have to switch to usd because i am from bg and it is expected most of the customers to also be from bulgaria but from what i see buglaria is not supported

#

but i think this will work

#

just one last question is there some workournd so eu bank transfer to work with bg somehow

tardy kite
#

Are you encountering errors?

vagrant zenith
#

yes i received an exception that the bulgaria is not in the supported countries and the given supported countries were NL, BE, FR and etc..

tardy kite
#

Can you share that erroring request ID please?

vagrant zenith
#

com.stripe.exception.InvalidRequestException: The country provided (BG) is not supported for eu_bank_transfer details. eu_bank_transfer details can be provided with the following countries: BE, DE, ES, FR, IE, or NL.; request-id: req_nn1OtYRXE8vgGT

tardy kite
#

Ah, right

#

ok:

Set payment_method_options[customer_balance][bank_transfer][eu_bank_transfer][country] to one of BE, DE, FR, IE or NL. The IBAN displayed to the customer is localized to the chosen country.

#

This is to localize the IBAN for the customer, so you can use their country if available, or yours, or default to another such an IE

#

The customer should still be able to transfer to it without issue, its just aesthetic preference to show a domestic IBAN when available

#

The transfer payment option is supported for all sepa countries, but we cant offer local IBANs in all of them

vagrant zenith
#

sure then how to set it up right now

tardy kite
#

The list there is the countries where we can localize ibans

#

pick one of the other countries

vagrant zenith
#

alright

#

and when they transfer the money i will receive them in my stripe account right

tardy kite
#

Yes, its just the IBAN country of the receiver account

#

but it always directs to you / your customer's balance in your account

vagrant zenith
#

and there will no problem if the customer with bg bank account send a bank trasnfer to to french bank account

#

sure

tardy kite
#

There should not be, no

vagrant zenith
#

so can you explain how those cutomer balnce accounts works in stripe necause i am a bit confused

#

stripe create a customer balance account for each one of my customers right?

tardy kite
#

Yes, each will get a cash balance using this approach

vagrant zenith
#

so do they need some interaction with stripe or it is just the way stripe finishing payments

#

because i jsut want from the customers to send the money through their bank accounts i do not want to make their life harder with using stripe directly

#

and also when they send the money and payment_intent.succeed webhook is reached will an invoice be created automatically?

#

Sorry for the endless question but it is easier to be clarified by you at once, instead of reading endless docs

tardy kite
#

You provide them funding instructions for that IBAN however you like. Payment Element can show it, or you can show it manually, then they trasnfer funds, yea