These credits can be provided to the customer for promoting the product. You can use Promotional Credits to offer referral bonuses, cash back offers and more. When a customer has promotional credits, it is automatically applied whenever a new invoice is created.
{
"amount": 100,
"closing_balance": 100,
"created_at": 1517501388,
"credit_type": "general",
"currency_code": "USD",
"customer_id": "__test__KyVnHhSBWStxi4s",
"description": "add promotional credits",
"done_by": "full_access_key_v1",
"id": "pc___test__KyVnHhSBWStz44u",
"object": "promotional_credit",
"type": "increment"
}
promotionalcredit.PromotionalCredit
This API call can be used to add promotional credits to a customer. Learn more about Promotional Credits.
For example, if a customer has credits of $10, if you pass the amount as $10, then the customer’s credit balance would become $20.
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Add(&promotionalcredit.AddRequestParams { CustomerId : "__test__KyVnHhSBWStxi4s", Amount : chargebee.Int64(100), Description : "add promotional credits", }).Request() if err != nil { fmt.Println(err) }else{ Customer := res.Customer PromotionalCredit := res.PromotionalCredit } }
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Add(&promotionalcredit.AddRequestParams { CustomerId : "__test__KyVnHhSBWStxi4s", Amount : chargebee.Int64(100), Description : "add promotional credits", }).Request() if err != nil { fmt.Println(err) }else{ Customer := res.Customer PromotionalCredit := res.PromotionalCredit } }
promotionalCreditAction.Add(&promotionalCredit.AddRequestParams {<param name> : <value>,<param name> : <value> ...}).Request()
This API call can be used to deduct promotional credits for a customer. Learn more about Promotional Credits.
For example, if a customer has a credit balance of $20, if you pass the amount as $5, then the customer’s credit balance would become $15.
If you do not pass any amount as the input parameter then, it will deduct the whole available amount from the credit balance.
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Deduct(&promotionalcredit.DeductRequestParams { CustomerId : "__test__KyVnHhSBWSuFQ4x", Amount : chargebee.Int64(100), Description : "deduct promotional credits", }).Request() if err != nil { fmt.Println(err) }else{ Customer := res.Customer PromotionalCredit := res.PromotionalCredit } }
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Deduct(&promotionalcredit.DeductRequestParams { CustomerId : "__test__KyVnHhSBWSuFQ4x", Amount : chargebee.Int64(100), Description : "deduct promotional credits", }).Request() if err != nil { fmt.Println(err) }else{ Customer := res.Customer PromotionalCredit := res.PromotionalCredit } }
promotionalCreditAction.Deduct(&promotionalCredit.DeductRequestParams {<param name> : <value>,<param name> : <value> ...}).Request()
This API call can be used to set the promotional credits balance of a customer. Learn more about Promotional Credits.
For example,
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Set(&promotionalcredit.SetRequestParams { CustomerId : "__test__KyVnHhSBWSuPk5A", Amount : chargebee.Int64(100), Description : "set promotional credits", }).Request() if err != nil { fmt.Println(err) }else{ Customer := res.Customer PromotionalCredit := res.PromotionalCredit } }
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Set(&promotionalcredit.SetRequestParams { CustomerId : "__test__KyVnHhSBWSuPk5A", Amount : chargebee.Int64(100), Description : "set promotional credits", }).Request() if err != nil { fmt.Println(err) }else{ Customer := res.Customer PromotionalCredit := res.PromotionalCredit } }
promotionalCreditAction.Set(&promotionalCredit.SetRequestParams {<param name> : <value>,<param name> : <value> ...}).Request()
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" "github.com/chargebee/chargebee-go/v3/filter" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.List(&promotionalcredit.ListRequestParams { Limit : chargebee.Int32(5), }).ListRequest() if err != nil { fmt.Println(err) }else{ for idx := 0; idx < len(res.List); idx++ { PromotionalCredit := res.List[idx].PromotionalCredit } } }
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" "github.com/chargebee/chargebee-go/v3/filter" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.List(&promotionalcredit.ListRequestParams { Limit : chargebee.Int32(5), }).ListRequest() if err != nil { fmt.Println(err) }else{ for idx := 0; idx < len(res.List); idx++ { PromotionalCredit := res.List[idx].PromotionalCredit } } }
promotionalCreditAction.List(&promotionalCredit.ListRequestParams {<param name> : <value>,<param name> : <value> ...}).ListRequest()
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Retrieve("pc___test__KyVnHhSBWSuN257").Request() if err != nil { fmt.Println(err) }else{ PromotionalCredit := res.PromotionalCredit } }
package main import ( "fmt" "github.com/chargebee/chargebee-go/v3" promotionalcreditAction "github.com/chargebee/chargebee-go/v3/actions/promotionalcredit" "github.com/chargebee/chargebee-go/v3/models/promotionalcredit" ) func main() { chargebee.Configure("{site_api_key}","{site}"); res,err := promotionalcreditAction.Retrieve("pc___test__KyVnHhSBWSuN257").Request() if err != nil { fmt.Println(err) }else{ PromotionalCredit := res.PromotionalCredit } }
promotionalCreditAction.Retrieve(<account_credit_id>,&promotionalCredit.RetrieveRequestParams {<param name> : <value>,<param name> : <value> ...}).Request()