至於講到這裏的條紋文檔中:
https://stripe.com/docs/charges
簡而言之:其實你不守信用卡信息自己。你真的不想這樣做,因爲它創建要避免的安全環境。認真。 PCI合規性是huge book。
相反,他們記住了信用卡信息,並給你,你可以用它來指代數據與後來的令牌。
從他們的榜樣,在Ruby中:
# 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.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"
# Get the credit card details submitted by the form
token = request.POST['stripeToken']
# Create a Customer
customer = stripe.Customer.create(
source=token,
description="Example customer"
)
# Charge the Customer instead of the card
stripe.Charge.create(
amount=1000, # in cents
currency="usd",
customer=customer.id
)
# YOUR CODE: Save the customer ID and other info in a database for later!
# YOUR CODE: When it's time to charge the customer again, retrieve the customer ID!
stripe.Charge.create(
amount=1500, # $15.00 this time
currency="usd",
customer=customer_id # Previously stored, then retrieved
)
編輯基於COMMENT
這確實你問什麼了。它捕獲的信用卡詳細資料,讓他們對帶鋼,然後當你需要,你可以訪問它們。
特別要注意這行:
# YOUR CODE: Save the customer ID and other info in a database for later!
# YOUR CODE: When it's time to charge the customer again, retrieve the customer ID!
stripe.Charge.create(
amount=1500, # $15.00 this time
currency="usd",
customer=customer_id # Previously stored, then retrieved
)
當是時候進行充電,檢索令牌並執行收費。
從條紋常見問題:https://support.stripe.com/questions/can-i-save-a-card-and-charge-it-later –
@JeremyJStarcher,因爲它說「#向客戶收費而不是卡「。它會創建一個客戶並向他們收費。但如何「不收費」? – ako25
@JeremyJStarcher,或當我捕捉到的信用卡資料,我怎麼能救他們?該鏈接沒有描述。 – ako25