Skip to content

Latest commit

 

History

History
108 lines (72 loc) · 2.52 KB

File metadata and controls

108 lines (72 loc) · 2.52 KB

list

List all promotion codes

Returns a list of your promotion codes.

API Endpoint: GET /v1/promotion_codes

Synchronous Client

from os import getenv
from sideko_stripe import Stripe

client = Stripe(token=getenv("API_TOKEN"))
res = client.promotion_code.list()

Asynchronous Client

from os import getenv
from sideko_stripe import AsyncStripe

client = AsyncStripe(token=getenv("API_TOKEN"))
res = await client.promotion_code.list()

get

Retrieve a promotion code

Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing code use list with the desired code.

API Endpoint: GET /v1/promotion_codes/{promotion_code}

Synchronous Client

from os import getenv
from sideko_stripe import Stripe

client = Stripe(token=getenv("API_TOKEN"))
res = client.promotion_code.get(promotion_code="string")

Asynchronous Client

from os import getenv
from sideko_stripe import AsyncStripe

client = AsyncStripe(token=getenv("API_TOKEN"))
res = await client.promotion_code.get(promotion_code="string")

create

Create a promotion code

A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.

API Endpoint: POST /v1/promotion_codes

Synchronous Client

from os import getenv
from sideko_stripe import Stripe

client = Stripe(token=getenv("API_TOKEN"))
res = client.promotion_code.create(coupon="string")

Asynchronous Client

from os import getenv
from sideko_stripe import AsyncStripe

client = AsyncStripe(token=getenv("API_TOKEN"))
res = await client.promotion_code.create(coupon="string")

update

Update a promotion code

Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.

API Endpoint: POST /v1/promotion_codes/{promotion_code}

Synchronous Client

from os import getenv
from sideko_stripe import Stripe

client = Stripe(token=getenv("API_TOKEN"))
res = client.promotion_code.update(promotion_code="string")

Asynchronous Client

from os import getenv
from sideko_stripe import AsyncStripe

client = AsyncStripe(token=getenv("API_TOKEN"))
res = await client.promotion_code.update(promotion_code="string")