如何在使用php创建发票后获取条带发票链接

如何在使用php创建发票后获取条带发票链接,php,stripe-payments,stripe-invoices,Php,Stripe Payments,Stripe Invoices,我已使用条带发票创建创建了发票id: $invoice = \Stripe\Invoice::create([ "customer" => "customer_id", ]); 但是要获取以invst\uuz开头的发票id,那么如何获取该id 因此,我将访问类似于此链接的发票 https://pay.stripe.com/invoice/invst_您需要先确定发票 我不知道你在用什么语言。它看起来像是直接取自Stripe API文档的

我已使用条带发票创建创建了发票id:

$invoice = \Stripe\Invoice::create([
   "customer" => "customer_id",
   ]);
但是要获取以
invst\uuz
开头的发票id,那么如何获取该id

因此,我将访问类似于此链接的发票


https://pay.stripe.com/invoice/invst_

您需要先确定发票

我不知道你在用什么语言。它看起来像是直接取自Stripe API文档的PHP代码,最终完成应该是这样的:


$stripe = new \Stripe\StripeClient(
  'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
);

$stripe->invoices->finalizeInvoice(
  'in_1BjOrj2eZvKYlo2CTTfU9xqe',
  []
);


然后返回的对象应该有一个带有您要查找的url的
托管的\u invoice\u url
属性。

我有自己的答案。使用以下信息获取发票详细信息:

$invoiceId = $subscription->latest_invoice;
$invoice = \Stripe\Invoice::retrieve($invoiceId);
$invoice_hosted_url = $invoice->hosted_invoice_url;
$invoice_pdf = $invoice->invoice_pdf;

invoice\u hosted\u url
是带有
invst\u的主发票链接,也是发票的完整链接。

条带发票ID以
in\u
开始,并且始终具有:但我想要这个***链接,因此如果我使用invst,那么它应该可以正常工作
invst\u
对象是条带内部唯一对象,您无法执行任何操作具有如果您想要托管发票URL,那么您可以按照Kaom Te的建议执行以下操作,并在完成发票后获取
托管发票URL