Skip to content

Quick Checkout (Direct Payment Link) ​

The QuickCheckoutService generates a direct Shopier checkout URL (https://www.shopier.com/s/payment/{account}/{order_id}) by executing the frontend checkout flow on behalf of the customer.

It can be accessed directly from client.QuickCheckout on a configured shopier.Client, or initialized standalone via shopier.NewQuickCheckoutService() without needing an API token.


Concurrency and Session Isolation ​

Each invocation of Create instantiates a dedicated, isolated cookie jar (net/http/cookiejar) and executes an independent HTTP session. This ensures that concurrent requests never leak cookies, sessions, or CSRF tokens across goroutines.


Quickstart Example ​

go
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/AdisGroup/shopier-go"
)

func main() {
	qc := shopier.NewQuickCheckoutService(
		shopier.WithQuickCheckoutTimeout(30 * time.Second),
	)

	ctx := context.Background()

	req := &shopier.QuickCheckoutRequest{
		ProductURL: "https://www.shopier.com/adisgroup/50900391",
		Quantity:   1,
		Buyer: shopier.QuickCheckoutBuyer{
			Email:     "customer@example.com",
			FirstName: "Özgün Deniz",
			LastName:  "Küçük",
			Phone:     "+90 532 477 02 10",
			Country:   "Türkiye",
			City:      "İstanbul",
			Address:   "Merkez Mah. No: 1",
			Comment:   "Please deliver during work hours.",
		},
	}

	result, err := qc.Create(ctx, req)
	if err != nil {
		var qErr *shopier.QuickCheckoutError
		if qErr, ok := err.(*shopier.QuickCheckoutError); ok {
			log.Fatalf("Checkout failed at stage [%s]: HTTP %d - %s",
				qErr.Stage, qErr.StatusCode, qErr.Message)
		}
		log.Fatalf("Checkout failed: %v", err)
	}

	fmt.Printf("Order ID   : %s\n", result.OrderID)
	fmt.Printf("Payment URL: %s\n", result.PaymentURL)
}

Request Parameters ​

QuickCheckoutRequest ​

FieldTypeDescription
ProductURLstringFull product URL (e.g. https://www.shopier.com/adisgroup/50900391). Account and ProductID are automatically parsed if set.
AccountstringSeller account username / shop slug (e.g. adisgroup).
ProductIDstringProduct identifier (e.g. 50900391).
QuantityintPurchase quantity. Defaults to 1 if omitted.
Optionsmap[string]stringOptional variation or selection form values.
BuyerQuickCheckoutBuyerBuyer contact and shipping information.

QuickCheckoutBuyer ​

FieldTypeDescription
EmailstringRequired. Buyer email address.
FirstNamestringRequired. Buyer first name.
LastNamestringRequired. Buyer last name.
PhonestringRequired. Phone number (e.g. +90 532 477 02 10).
PhoneCodestringCountry dial code (defaults to "TR").
CountrystringDestination country (defaults to "Türkiye").
CitystringDelivery city.
StatestringDelivery state/district.
AddressstringFull street address.
ZipCodestringPostal code.
TCIDNostringNational identity number (optional).
CommentstringOrder notes or delivery instructions.

Result Structure ​

QuickCheckoutResult ​

go
type QuickCheckoutResult struct {
	OrderID     string         `json:"order_id"`
	PaymentURL  string         `json:"payment_url"`
	Account     string         `json:"account"`
	ProductID   string         `json:"product_id"`
	RawResponse map[string]any `json:"raw_response,omitempty"`
}

Configuration Options ​

OptionDescription
WithQuickCheckoutBaseURL(url)Sets custom base URL (default: https://www.shopier.com).
WithQuickCheckoutUserAgent(ua)Custom User-Agent string sent with requests.
WithQuickCheckoutHTTPClient(client)Custom *http.Client for proxies and transport configurations.
WithQuickCheckoutTimeout(d)Request timeout duration (default: 30s).

Error Handling ​

Failures return *QuickCheckoutError with the exact execution stage:

go
type QuickCheckoutStage string

const (
	StageParseInput        QuickCheckoutStage = "parse_input"
	StageFetchProduct      QuickCheckoutStage = "fetch_product"
	StageExtractCSRF       QuickCheckoutStage = "extract_csrf"
	StageCheckPayment      QuickCheckoutStage = "check_payment"
	StageFetchShippingForm QuickCheckoutStage = "fetch_shipping_form"
	StageProcessShipment   QuickCheckoutStage = "process_shipment"
)