#amfpaulo_invoices-payment-intent-terminal
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/1358832434959089850
๐ 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.
- amfpaulo_api, 2 days ago, 12 messages
- amfpaulo_docs, 3 days ago, 28 messages
Everything seems to work, the only problem its the last step, using the collected intent to pay for the invoice
Hi ๐
What do you mean by "manually" pay an Invoice? If you have generated an invoice and you wish to pay it with a saved payment method, you can use the Pay API
Can you share an API request ID for the request that fails? It will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
I generate a payment intent, I create a invoice and I want to use thie payment to pay for the invoice
I informed the request id
look, please do not give me generic answers, everything works so far, I am trying to do is almost working, plese read everything a added to the question
this is the charge I tried to use to pay for the invoice: ch_3RBHo1Dn6CAQGXZn2K5zP4K3
this is the request:
req_zz3BJ17te7S6vh ๐
I generate a payment intent, I create a invoice and I want to use thie payment to pay for the invoice
THis is already wrong
If you create a Payment Intent separately from the Invoice, payment for that Intent has no relation to the Invoice at all
Ok, so what is the correct way to generate a payment intent for a invoice that can be paid
Create the Invoice first
This will generate a Payment Intent that is linked to that Invoice
Confirm that Payment Intent and the Invoice will be paid
I need to return to the client paymentIntentId and ClientSecret so the payment can be collected, where are those Fields on the invoice Object ?
Also, I am going to be able to collect the payment if client pays using apple pay, I thing I remember this being a limitation if payment intent was generated by a invoice
when I create a invoice , invoice.PaymentIntent is null
so I cant access the Secret
Then you are creating the Invoice incorrectly. Can you share the request where you create the Invoice?
yes. just a second
var options = new InvoiceCreateOptions
{
Customer = customerId,
CollectionMethod = collectionMethod,
DaysUntilDue = 1,
Metadata = new Dictionary<string, string> {
{ "origin", "payjj" },
{ "comission", string.Join(',', request.SalesPersonIds) },
{ "discount", request.Discount.ToString() },
{ "intent", paymentIntent.Id },
{ "wallet", paymentMethodType },
},
AutomaticTax = new InvoiceAutomaticTaxOptions { Enabled = true },
AutoAdvance = false,
};
var invoiceService = new InvoiceService();
var invoice = invoiceService.Create(options);
this works with "charge_automatically" payment, using client card on file
Please provide the request ID
Using charge_automatically will charge the customer's card on file but the Payment Intent you added will never be confirmed
Thanks, taking a look
thank you
This request sets auto_advance to false
The Invoice is created in this request but there is no Payment Intent because it is not finalized yet. It's still in draft status.
You finalize the Invoice here and now there is a Payment Intent pi_3RBINlDn6CAQGXZn13p4P0Vn
That Payment Intent is what you use to Pay the Invoice in our normal flow
I am finilizing the invoice, you can see on my code
sorry i did no sent this part
invoiceService.FinalizeInvoice(invoice.Id, new InvoiceFinalizeOptions { AutoAdvance = false });
Is the reason the AutoAdvance = false, that its not creating the Intent ?
I can see the intent on the dashboard , so its creating, may be a i need to expand something ? or query the invoice again, I am doing the correct process
You are creating the Payment Intent when you finalize the Invoice. If you want to access the Client Secret, you need to expand the Payment Intent when you make the Finalize request
Then you can use that client secret with the Payment Element to collect payment method information
It makes sense, what is the expand string? "payment_intent" by the way is there any doc I can see possible expand options for each type of transaction ?
I did this, no error, paymentIntent still null:
invoiceService.FinalizeInvoice(invoice.Id, new InvoiceFinalizeOptions
{
Expand = new List<string> { "payment_intent" },
AutoAdvance = false
});
I might be need to Get the invoice ?
You can see the expandable properties on our API reference docs, like for the Invoice. Each expandable property will have the Expandable badge next to it
ya, I noticed the badges now
anyways, I truied to finalize using expand, but did not work
Ok, I found my mistake
I was looking the wrong var, now using expand I get the intent. My last question is. Can the client pay for the invoice (payment intent ) using Apple Pay ?
Its M2 Terminal
that is the problem, everytime a seek support M2 is completely ignored
documentation is also poor
In that case, it's the same as using a Payment Intent
I did other integration with out coming here for any questions, everything was in the dos, but M2 everything works diff and no docs
ok cool
Oh wait. no
This won't work. You cannot use card_present as a payment method type with Invoices
I was happy too soon
ok, Ya, I remeber this
idk why stripe limits M2 like that,
Anyways, I have a solution, just tell me if my strategy will work....
If I collect a payment, in this case could possibly be apple pay, no invoice involved, just a payment intent created, validated, collected.
If I pay the invoice like that
await invoiceService.PayAsync(invoice.Id, new InvoicePayOptions { PaidOutOfBand = true });
invoice will be marked as paid right ?
I'll add the charge Id on the metadata just to keep track of it, and also control this on my database side
Correct. If you want to generate Invoices for these payments I think that is your best option.