1

我正在使用带有 bitpay php api 的 btcpayserver。尝试在付款中实施 ipn 并将变量发送到电子邮件。

ipn 会生成这样的日志文件:

Raw IPN: {
  "id": "KrYtvetS9oQ9s7CDErk,
  "url": "https://btcpayserv.net/invoice?id=KrYtvetS9oQ9s7",
  "posData": null,
  "status": "paid",
  "btcPrice": "0.00162327",
  "price": 11.99,
  "currency": "EUR",
  "invoiceTime": 1569570609000,
  "expirationTime": 1569571509000,
  "currentTime": 1569570697070,
  "btcPaid": "0.00162327",
  "btcDue": "0.00000000",
  "rate": 7386.36657706093,
  "exceptionStatus": false,
  "buyerFields": {
    "buyerEmail": "buyeremail@test.com"
  },
  "transactionCurrency":

ipn 在 php 中获取这样的数据: $ipn = json_decode($raw_post_data);

php

$ipn = json_decode($raw_post_data);

$invoice = $client->getInvoice($ipn->id);
$invoiceId = $invoice->getId();
$invoiceUrl = $invoice->getUrl();
$invoiceStatus = $invoice->getStatus();
$invoiceExceptionStatus = $invoice->getExceptionStatus();
$invoicePrice = $invoice->getPrice();
$invoiceBtcPrice = $invoice->getbtcPrice();

我可以通过 php 邮件发送一些这样的字段:

$message = 'Date:' . $date .  ', ID: ' . $invoiceId . ', Status: ' . $invoiceStatus . ', Url: ' . $invoiceUrl . ', BTC Price: ' . $invoiceBtcPrice . ', Price: ' . $invoicePrice;

但我想发送 RAW IPN 的这个变量:“buyerEmail”:“buyeremail@test.com”

做不到。

4

0 回答 0