私は現在、Chargify を使用して定期請求を受け入れる Rails アプリケーションを開発しています。私は彼らのgemをインストールし、gemでChargifyに接続することができました. ただし、一部のサブスクリプションは通過し、一部は通過しません。
私の質問は、宝石がサーバーと通信した後、どのように応答を処理または処理するのですか?
開発ログには、データ転送の成功または失敗を示すものは何も表示されません。gem のドキュメントにも、これに関する記述はありません。
ご覧いただきありがとうございます。
アップデート
私が遊んでいるコードは、チェックアウトコントローラーにあります。
def checkout @customer = Customer.new(params[:customer])
Chargify::Customer.create(
:first_name => "Charlie",
:last_name => "Bull",
:email => "charlie@example.com",
:organization => "Chargify"
)
Chargify::Subscription.create(
:product_handle => 'recurring',
:customer_attriburtes => {
:first_name => @customer.shipping_first_name,
:last_name => @customer.shipping_last_name,
:email => @customer.email
},
:payment_profile_attributes => {
:first_name => @customer.shipping_first_name,
:last_name => @customer.shipping_last_name,
:full_number => "1",
:expiration_month => 1,
:expiration_year => 2012,
:billing_address => @customer.shipping_street_address,
:billing_city => @customer.shipping_city,
:billing_state => @customer.shipping_state,
:billing_zip => @customer.shipping_zip_code,
:billing_country => @customer.shipping_country
}
)
#if @subscription.save
# logger.info "saved description"
# redirect_to process_path
#else
# redirect_to :back, :alert =>"There was an error."
#end
終わり
顧客の作成は完了していますが、サブスクリプションは完了していません。サーバーからのコールバックを探しているだけなので、それが成功したかどうかに基づいて行動し、サブスクリプションが行われていない理由を見つけることができます。