Creates a new source object.
curl https://api.stripe.com/v1/sources \
-u STRIPE_SECRET_KEY: \
-d type=bitcoin \
-d amount=1000 \
-d currency=usd \
-d owner[email]="jenny.rosen@example.com" \
-X POST
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
string ls_StrResponseBody
oleobject loo_JsonResponse
string ls_Id
string ls_Object
integer li_Amount
string ls_Client_secret
integer li_Created
string ls_Currency
string ls_Flow
integer li_Livemode
integer li_OwnerAddress
string ls_OwnerEmail
integer li_OwnerName
integer li_OwnerPhone
integer li_OwnerVerified_address
integer li_OwnerVerified_email
integer li_OwnerVerified_name
integer li_OwnerVerified_phone
string ls_ReceiverAddress
integer li_ReceiverAmount_charged
integer li_ReceiverAmount_received
integer li_ReceiverAmount_returned
string ls_ReceiverRefund_attributes_method
string ls_ReceiverRefund_attributes_status
integer li_Statement_descriptor
string ls_Status
string ls_Type
string ls_Usage
string ls_BitcoinAddress
integer li_BitcoinAmount
integer li_BitcoinAmount_charged
integer li_BitcoinAmount_received
integer li_BitcoinAmount_returned
string ls_BitcoinUri
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
// URL: https://api.stripe.com/v1/sources
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("api.stripe.com",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_Rest.SetAuthBasic("STRIPE_SECRET_KEY","")
loo_Rest.AddQueryParam("type","bitcoin")
loo_Rest.AddQueryParam("amount","1000")
loo_Rest.AddQueryParam("currency","usd")
loo_Rest.AddQueryParam("owner[email]","jenny.rosen@example.com")
ls_StrResponseBody = loo_Rest.FullRequestFormUrlEncoded("POST","/v1/sources")
if loo_Rest.LastMethodSuccess <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_JsonResponse = create oleobject
li_rc = loo_JsonResponse.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JsonResponse.Load(ls_StrResponseBody)
ls_Id = loo_JsonResponse.StringOf("id")
ls_Object = loo_JsonResponse.StringOf("object")
li_Amount = loo_JsonResponse.IntOf("amount")
ls_Client_secret = loo_JsonResponse.StringOf("client_secret")
li_Created = loo_JsonResponse.IntOf("created")
ls_Currency = loo_JsonResponse.StringOf("currency")
ls_Flow = loo_JsonResponse.StringOf("flow")
li_Livemode = loo_JsonResponse.BoolOf("livemode")
li_OwnerAddress = loo_JsonResponse.IsNullOf("owner.address")
ls_OwnerEmail = loo_JsonResponse.StringOf("owner.email")
li_OwnerName = loo_JsonResponse.IsNullOf("owner.name")
li_OwnerPhone = loo_JsonResponse.IsNullOf("owner.phone")
li_OwnerVerified_address = loo_JsonResponse.IsNullOf("owner.verified_address")
li_OwnerVerified_email = loo_JsonResponse.IsNullOf("owner.verified_email")
li_OwnerVerified_name = loo_JsonResponse.IsNullOf("owner.verified_name")
li_OwnerVerified_phone = loo_JsonResponse.IsNullOf("owner.verified_phone")
ls_ReceiverAddress = loo_JsonResponse.StringOf("receiver.address")
li_ReceiverAmount_charged = loo_JsonResponse.IntOf("receiver.amount_charged")
li_ReceiverAmount_received = loo_JsonResponse.IntOf("receiver.amount_received")
li_ReceiverAmount_returned = loo_JsonResponse.IntOf("receiver.amount_returned")
ls_ReceiverRefund_attributes_method = loo_JsonResponse.StringOf("receiver.refund_attributes_method")
ls_ReceiverRefund_attributes_status = loo_JsonResponse.StringOf("receiver.refund_attributes_status")
li_Statement_descriptor = loo_JsonResponse.IsNullOf("statement_descriptor")
ls_Status = loo_JsonResponse.StringOf("status")
ls_Type = loo_JsonResponse.StringOf("type")
ls_Usage = loo_JsonResponse.StringOf("usage")
ls_BitcoinAddress = loo_JsonResponse.StringOf("bitcoin.address")
li_BitcoinAmount = loo_JsonResponse.IntOf("bitcoin.amount")
li_BitcoinAmount_charged = loo_JsonResponse.IntOf("bitcoin.amount_charged")
li_BitcoinAmount_received = loo_JsonResponse.IntOf("bitcoin.amount_received")
li_BitcoinAmount_returned = loo_JsonResponse.IntOf("bitcoin.amount_returned")
ls_BitcoinUri = loo_JsonResponse.StringOf("bitcoin.uri")
destroy loo_Rest
destroy loo_JsonResponse
{
"id": "src_1BnETKGswQrCoh0XUrU9xVhU",
"object": "source",
"amount": 1000,
"client_secret": "src_client_secret_CBbgwhcWX2mz2uzcVsX3vjfe",
"created": 1516662782,
"currency": "usd",
"flow": "receiver",
"livemode": false,
"metadata": {},
"owner": {
"address": null,
"email": "jenny.rosen@example.com",
"name": null,
"phone": null,
"verified_address": null,
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "bitcoin",
"usage": "single_use",
"bitcoin": {
"address": "test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N",
"amount": 2371000,
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"uri": "bitcoin:test_1MBhWS3uv4ynCfQXF3xQjJkzFPukr4K56N?amount=0.02371000"
}
}