#set_code
1 messages Ā· Page 1 of 1 (latest)
š Welcome to your new thread!
ā²ļø We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
ā±ļø We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
š This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1260875277144166420
š Have more to share? Add details, code, screenshots, videos, etc. below.
// SubscriptionCancel åę¶č®¢é
func (c *Client) SubscriptionCancel(subId string) (*stripe.Subscription, error) {
logx.Infof("cancel subscription id: %s", subId)
c.SetSecretKey()
s, err := subscription.Cancel(subId, &stripe.SubscriptionCancelParams{})
if err != nil {
logx.Error(err)
return nil, err
}
return s, nil
}
this is my code of golang
my subscription info get by stripe api: &{APIResource:{LastResponse:0xc000a1d1a0} Application:<nil> ApplicationFeePercent:0 AutomaticTax:0xc0000638b0 BillingCycleAnchor:1720603415 BillingCycleAnchorConfig:<nil> Billing
Thresholds:<nil> CancelAt:0 CancelAtPeriodEnd:false CanceledAt:0 CancellationDetails:0xc001002f30 CollectionMethod:charge_automatically Created:1720603415 Currency:usd CurrentPeriodEnd:1723281815 CurrentPeriodStart:1720603415 Custom
er:0xc000822640 DaysUntilDue:0 DefaultPaymentMethod:0xc0007c48c0 DefaultSource:<nil> DefaultTaxRates:[] Description: Discount:<nil> Discounts:[] EndedAt:1720603490 ID:sub_1PawkNLUcBgWL3sjd4V4TR5E InvoiceSettings:0xc000714dc0 Items:0
xc000730fc0 LatestInvoice:0xc000c9c808 Livemode:false Metadata:map[identity_code:f40d7fd8-4122-48c8-b493-b515a83129d8] NextPendingInvoiceItemInvoice:0 Object:subscription OnBehalfOf:<nil> PauseCollection:<nil> PaymentSettings:0xc001
0030b0 PendingInvoiceItemInterval:<nil> PendingSetupIntent:<nil> PendingUpdate:<nil> Schedule:<nil> StartDate:1720603415 Status:canceled TestClock:<nil> TransferData:<nil> TrialEnd:0 TrialSettings:0xc0000a2500 TrialStart:0}
Hi, let me help you with this.
after i call subscription.Cancel i get response :
{"code":"resource_missing","doc_url":"https://stripe.com/docs/error-codes/resource-missing","status":404,"message":"No such subscription: 'sub_1PawkNLUcBgWL3sjd4V4TR5E'","param":"id","
request_id":"req_myhZNv5FkKD9a6","request_log_url":"https://dashboard.stripe.com/test/logs/req_myhZNv5FkKD9a6?t=1720682182","type":"invalid_request_error"}
Ther Subscription was already deleted, that's why it's not found: https://dashboard.stripe.com/test/logs/req_bg21hziTxPbxnK