#.antoniot

1 messages · Page 1 of 1 (latest)

hollow kiteBOT
vagrant whale
#

Invoices create PaymentIntents, so the way to do this would be to create the invoice on the connected account

turbid cave
#

ok im using that but in golang sdk v74 theres no place to add the amount to charge

#

also when I expand a payment intent it doesnt provide the payment intent ID

#
    invoiceCreateParams := &stripe.InvoiceParams{
        AutoAdvance:          stripe.Bool(false),
        ApplicationFeeAmount: stripe.Int64(int64(scenefileCommunity.Price * 100 * 0.15)),
        Customer:             stripe.String(customerID),
        Currency:             stripe.String(string(stripe.CurrencyUSD)),
        DefaultPaymentMethod: stripe.String(paymentMethodID),
    }
    invoiceCreateParams.AddExpand("payment_intent")
    invoiceCreateParams.AddMetadata("uuid_user", uuidUser)
    invoiceCreateParams.AddMetadata("uuid_community_profile", scenefileCommunity.UUIDProfileCommunity)
    invoiceCreateParams.AddMetadata("uuid_file_community", scenefileCommunity.UUIDFileCommunity)
    invoiceCreateParams.AddMetadata("type", "marketplace")
    invoiceCreateParams.SetStripeAccount(stripeConnect.AccountStripeID)
    inv, err := invoice.New(invoiceCreateParams)
#

InvoiceParams on that struct there is no amount to debit or something like that

vagrant whale
#

When you create an invoice like that, it will be in a draft state, you will need to finalize the invoice for it to create a PaymentIntent

#

That doc demonstrates how to create and finalize an invoice

turbid cave
#

oh so after the invoice creation i have to finalize

vagrant whale
#

Correct

turbid cave
#

ok im doint this now but the invoice is on incomplete status


    invoiceCreateParams := &stripe.InvoiceParams{
        AutoAdvance:          stripe.Bool(false),
        ApplicationFeeAmount: stripe.Int64(int64(scenefileCommunity.Price * 100 * 0.15)),
        Customer:             stripe.String(customerID),
        Currency:             stripe.String(string(stripe.CurrencyUSD)),
        DefaultPaymentMethod: stripe.String(paymentMethodID),
    }
    invoiceCreateParams.AddExpand("payment_intent")
    invoiceCreateParams.AddMetadata("uuid_user", uuidUser)
    invoiceCreateParams.AddMetadata("uuid_community_profile", scenefileCommunity.UUIDProfileCommunity)
    invoiceCreateParams.AddMetadata("uuid_file_community", scenefileCommunity.UUIDFileCommunity)
    invoiceCreateParams.AddMetadata("type", "marketplace")
    invoiceCreateParams.SetStripeAccount(stripeConnect.AccountStripeID)
    inv, _ := invoice.New(invoiceCreateParams)

    itemParams := &stripe.InvoiceItemParams{
        Customer: stripe.String(customerID),
        Invoice:  stripe.String(inv.ID),
        Amount:   stripe.Int64(int64(scenefileCommunity.Price) * 100),
    }
    itemParams.SetStripeAccount(stripeConnect.AccountStripeID)
    invoiceitem.New(itemParams)

    invFinalizeParams := &stripe.InvoiceFinalizeInvoiceParams{
        AutoAdvance: stripe.Bool(true),
    }
    invFinalizeParams.SetStripeAccount(stripeConnect.AccountStripeID)
    result, _ := invoice.FinalizeInvoice(inv.ID, invFinalizeParams)

#

do I have to do something with payment intent confirm?

vagrant whale
turbid cave
#

is there a way to get the invoice/receipt hosted url after the pay thing?

vagrant whale