package features_paypal import ( "github.com/gofiber/fiber/v2" "github.com/plutov/paypal/v4" "os" "context" . "MY/webapp/common" config "MY/webapp/config" ) func GetApiStart(c *fiber.Ctx) error { ctx := context.Background() pay, err := paypal.NewClient( config.Settings.Paypal.ClientID, config.Settings.Paypal.SecretID, config.Settings.Paypal.URL) // or paypal.APIBaseLive if err != nil { return IfErrNil(err, c) } pay.SetLog(os.Stdout) pay.Token = &paypal.TokenResponse{Token: "dummy"} payout := paypal.Payout{ Items: []paypal.PayoutItem{ { Amount: &paypal.AmountPayout{ Currency: "USD", Value: "10.00", }, Receiver: "test@example.com", }, }, SenderBatchHeader: &paypal.SenderBatchHeader{ SenderBatchID: "BATCH123", }, } response, err := pay.CreatePayout(ctx, payout) if err != nil { return IfErrNil(err, c) } return c.JSON(response) } func SetupApi(app *fiber.App) { app.Get("/api/paypal/start", GetApiStart) }