0

私は Chargify API ( https://github.com/jforrest/Chargify-PHP-Client/ ) を使用しています。毎月のサブスクリプションで何千人もの顧客がいるため、特定の日付に請求されます。サブスクリプションをチェックする cron を使用しています日常的

問題は、請求されるはずの日付に請求できなかった場合、サブスクリプションを見逃していることです。アカウントに資金がないため、または何らかの理由でカードに問題が発生したために、顧客カードに請求できず、数日の遅延が発生しました。

chargify で顧客カードがいつ請求されたかを知りたいので、その時点で新しい注文を生成できます。上記の PHP ライブラリを使用しましたが、情報を取得する関数が見つかりませんでした。

これまたはこれを修正するための他の解決策を助けることができますか?

ありがとう

4

3 に答える 3

1

Webhook でセットアップし、顧客が課金するとすぐにすべての情報を取得できます。そのためには、サーバーに Webhook URL をセットアップし、課金アカウントに追加する必要があります。ログイン後、[設定] -> [Webhooks] -> [URL の追加] に移動します。

http://www.domain.com/webhooks/

「webhooks」ディレクトリの下に index.php ファイルを作成すると、次のように chargify から配列が取得されます。

Array
(
    [id] => 29660474
    [event] => renewal_success
    [payload] => Array
        (
            [subscription] => Array
                (
                    [activated_at] => 2014-12-12 06:11:51 -0500
                    [balance_in_cents] => 1900
                    [cancel_at_end_of_period] => false
                    [canceled_at] => 
                    [cancellation_message] => 
                    [created_at] => 2014-12-12 06:11:40 -0500
                    [current_period_ends_at] => 2015-02-12 06:11:40 -0500
                    [expires_at] => 
                    [id] => 7231335
                    [next_assessment_at] => 2015-02-12 06:11:40 -0500
                    [payment_collection_method] => automatic
                    [snap_day] => 
                    [state] => active
                    [trial_ended_at] => 
                    [trial_started_at] => 
                    [updated_at] => 2015-01-12 06:22:21 -0500
                    [current_period_started_at] => 2015-01-12 06:11:40 -0500
                    [previous_state] => active
                    [signup_payment_id] => 78110242
                    [signup_revenue] => 19.00
                    [delayed_cancel_at] => 
                    [coupon_code] => 
                    [total_revenue_in_cents] => 1900
                    [product_price_in_cents] => 1900
                    [product_version_number] => 6
                    [payment_type] => credit_card
                    [customer] => Array
                        (
                            [address] => xx xxxx place Success
                            [address_2] => 
                            [city] => Perth
                            [country] => AU
                            [created_at] => 2014-12-12 06:11:39 -0500
                            [email] => xxxxxxx@hotmail.com
                            [first_name] => Jay
                            [id] => 7093037
                            [last_name] => Gable
                            [organization] => Large
                            [phone] => xxxxxxxx
                            [portal_customer_created_at] => 2014-12-12 06:11:52 -0500
                            [portal_invite_last_accepted_at] => 
                            [portal_invite_last_sent_at] => 
                            [reference] => 548acd6a8ef3a
                            [state] => WA
                            [updated_at] => 2014-12-12 06:11:52 -0500
                            [verified] => false
                            [zip] => 6164
                        )
                    [product] => Array
                        (
                            [accounting_code] => 
                            [archived_at] => 
                            [created_at] => 2014-08-11 03:27:20 -0400
                            [description] => xxxx
                            [expiration_interval] => 
                            [expiration_interval_unit] => never
                            [handle] => monthly-subscription
                            [id] => 3493985
                            [initial_charge_in_cents] => 
                            [interval] => 1
                            [interval_unit] => month
                            [name] => 1 Pair Monthly
                            [price_in_cents] => 1900
                            [request_credit_card] => true
                            [require_credit_card] => true
                            [return_params] => 
                            [return_url] => 
                            [taxable] => false
                            [trial_interval] => 
                            [trial_interval_unit] => month
                            [trial_price_in_cents] => 
                            [update_return_url] => 
                            [updated_at] => 2014-12-11 17:09:41 -0500
                            [product_family] => Array
                                (
                                    [accounting_code] => 
                                    [description] => Standard Monthly Subscriptions
                                    [handle] => monthly-subscription
                                    [id] => 421701
                                    [name] => Australia
                                )
                            [public_signup_pages] => Array
                                (
                                    [id] => 100806
                                    [url] => xx
                                )
                        )
                    [credit_card] => Array
                        (
                            [billing_address] => xxxxx Success
                            [billing_address_2] => 
                            [billing_city] => Perth
                            [billing_country] => AU
                            [billing_state] => WA
                            [billing_zip] => 6164
                            [card_type] => master
                            [current_vault] => braintree_blue
                            [customer_id] => 7093037
                            [customer_vault_token] => 
                            [expiration_month] => 2
                            [expiration_year] => 2015
                            [first_name] => XXXX
                            [id] => 4693476
                            [last_name] => Gable
                            [masked_card_number] => XXXX-XXXX-XXXX-xxxx
                            [vault_token] => xxxxxx
                            [payment_type] => credit_card
                        )
                )
            [site] => Array
                (
                    [id] => xxxxx
                    [subdomain] => xxxxx
                )
        )
)

これが役立つことを願っています。

于 2015-07-19T13:39:24.710 に答える
1

Chargify には、特に「Webhook」と呼ばれる機能があります (Paypal、Stripe などと同様)。顧客のサブスクリプションにアクティビティがある場合 (毎月の更新など)、Chargify は POST リクエストをサーバーに直接送信して警告します。

具体的なドキュメントはこちら: https://docs.chargify.io/webhooks

cron ジョブは必要ありません。

于 2014-05-02T15:55:15.047 に答える
0

最も簡単な方法は、最後に成功したトランザクションの日付をDBに保存し、cronまたはmysqlイベントスケジューラを使用して最後の更新から1か月が経過したかどうかを頻繁に確認することです.chargifyを使用したことはありませんが、paypal APIはサーバーと通信してトランザクションのステータスを返すことができます.あなたのサイトでDBを更新するために使用します

于 2014-05-01T09:12:46.437 に答える