#wandriputra_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1329644190761488466
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Yes, you can see the PaymentIntent object after it has been paid
which event status that I need to use to get payment methods object or which methods from SDK that I can use?
You can find the Payment Intent Id first from checkout.session.completed, then call a Retrieve Payment Intent API to get its full object
Given that you are listening to checkout.session.completed
but I can't find this kind of response:
payment_method_details: {
card: {
amount_authorized: 35016531,
authorization_code: null,
brand: "visa",
checks: {
address_line1_check: null,
address_postal_code_check: null,
cvc_check: "pass",
},
country: "US",
exp_month: 12,
exp_year: 2031,
extended_authorization: {
status: "disabled",
},
fingerprint: "TLbEzqybgElJzQwc",
funding: "credit",
incremental_authorization: {
status: "unavailable",
},
installments: null,
last4: "4242",
mandate: null,
multicapture: {
status: "unavailable",
},
network: "visa",
network_token: {
used: false,
},
network_transaction_id: "847698691221131",
overcapture: {
maximum_amount_capturable: 35016531,
status: "unavailable",
},
regulated_status: "unregulated",
three_d_secure: null,
wallet: null,
},
type: "card",
},
This is payment_method_details inside the Charge object. If you want this, you would need to look at the Charge object inside the PaymentIntent
When call Retrieve Payment Intent API, expand the ['charge'] property
const stripePaymentIntent: Stripe.PaymentIntent = await this.stripeClient.paymentIntents.retrieve(paymentIntent['payment_intent'], { expand: ['carge'] });
try {
// handle adaptive payment if currency not eur
// and there is object on currency_conversion.amount_total
if (invoiceId && userId) {
this.validateInvoicePayment({
paymentNumber: paymentIntent["metadata"]["payment_number"],
paymentAmount: paymentIntent['currency_conversion']['amount_total'],
invoiceId: paymentIntent["metadata"]["invoice_id"]
}, {
method: PaymentMethod.STRIPE,
amountPaid: paymentIntent['currency_conversion']['amount_total'],
currency: paymentIntent['currency_conversion']["currency"],
stripePaymentIntentId: paymentIntent['id'],
paymentInformation: stripePaymentIntent.payment_method_configuration_details
} as StripePayment);
} else {
throw new Error('Invoice Id or user Id not defined.')
}
do think it's correct?
stripePaymentIntent.payment_method_configuration_details is correct variable?
You need charge not carge
WARN [StripePaymentService] Failed to verify paymentIntent: cs_test_a1b11M2vDpESt2AzWG1J02Wlcvk97zclb6Q6x31UtXph5mYJGKieXdtleE. Error: This property cannot be expanded (charge).
I have fixed it but still the same
Sorry, can you try payment_intent.charge ?
const stripePaymentIntent: Stripe.PaymentIntent = await this.stripeClient
.paymentIntents.retrieve(
paymentIntent['payment_intent'],
{ expand: ['payment_intent.charge'] }
);
like that?
still not working for me
You either call Retrieve Checkout Session and expand payment_intent.charge, or call Retrieve Payment Intent and expand charge
When you retrieve checkout.session.completed, you has the Checkout Session Id cs_test_xxx, and the Payment Intent Id inside it pi_xxx
- If you call Retrieve Payment Intent, you need to pass pi_xxx and expand
charge - If you call Retrieve Checkout Session, you need to pass cs_test_xxx and expand
payment_intent.charge