【问题标题】:how to get stripe invoice link after create an invoice using php使用php创建发票后如何获取条带发票链接
【发布时间】:2020-12-16 01:09:12
【问题描述】:

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

$invoice = \Stripe\Invoice::create([
   "customer" => "customer_id",
   ]);

但是想要获取以invst_ 开头的发票ID 那么我该如何获取呢?

所以我将使用此链接访问发票

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

【问题讨论】:

标签: php stripe-payments


【解决方案1】:

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

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

invoice_hosted_url 是带有invst_ 的主要发票链接和发票的完整链接。

【讨论】:

    【解决方案2】:

    您需要先完成发票。

    我不确定您使用的是什么语言。它看起来像 PHP 代码,直接取自 Stripe API 文档,最终确定应该是这样的:

    
    $stripe = new \Stripe\StripeClient(
      'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
    );
    
    $stripe->invoices->finalizeInvoice(
      'in_1BjOrj2eZvKYlo2CTTfU9xqe',
      []
    );
    
    

    那么返回的对象应该有一个hosted_invoice_url 属性和你正在寻找的url。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-02
      • 2011-08-20
      • 2018-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多