\Stripe\Stripe::setApiKey
このAPIはWebhookで完全に機能し、完全な結果を得ています。私はsubcription APIを使用した場合でも: Stripe Subscription ::検索は動作しませんテストWebhookエラー:500
\Stripe\Subscription::retrieve
は、それは私のテストウェブフック・エラーを与える:500
これは私のコードです:
$stripe_secret_key = '*****';
$dbname="****"; // database name
$usertable="*****"; // webhook table
require_once('wp-config.php');
$connection = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db($dbname, $connection);
require_once('webhook/vendor/autoload.php');
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey($stripe_secret_key);
// Retrieve the request's body and parse it as JSON
$input = @file_get_contents("php://input");
$event_json = json_decode($input);
$event_type = $event_json->type;
$chargeId = $event_json->data->object->charge;
$subcriptionKey = $event_json->data->object->lines->data[0]->id;
$customerId = $event_json->data->object->customer;
$amoutDue = $event_json->data->object->amount_due;
$paidStatus = $event_json->data->object->paid;
$interval = $event_json->data->object->lines->data[0]->plan->interval_count;
//insert query
$sql = "INSERT INTO epti_webhook ".
"(subscription_id,charge_id, customer_id,event_type, month_interval, paidStatus, data_response) "."VALUES ".
"('$subcriptionKey','$chargeId','$customerId','$event_type','$interval','$paidStatus','$input')";
$retval = mysql_query($sql, $connection);
if(! $retval) {
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
//count query
$result=mysql_query("SELECT count(*) as total from epti_webhook where subscription_id = '".$subcriptionKey."'");
$data=mysql_fetch_assoc($result);
echo $data['total'].'===';
if($data['total'] > '1'){
//issue is coming here
$sub = \Stripe\Subscription::retrieve("sub_A****");
$sub->cancel();
}
http_response_code(200); // PHP 5.4 or greater`
する人を助けが必要です。最新のストライプも更新しましたが、同じエラーが出ます。 ありがとうございます
お客様のIDから詳細を取得して疲れていて、契約をキャンセルしようとしています –