Finding a loyalty reward coupon by its code

I’ve built my own checkout and custom promo code system which is working fine. But I also want to integrate the Wix loyalty app to allow our site members to use their redeemed loyalty coupons at checkout, ie. having earned enough loyalty points they cashed them in for a reward and received a reference coupon with a unique Wix-generated code such as 6TLA4SKDC85Z. By entering this one-time-use code at checkout, they get a % discount.

I’ve read thru the loyalty coupon API documentation, and it seems fairly straightforward to find a coupon by its ID or the member ID. But how do I find the individual coupon by the code a site visitor has entered, 6TLA4SKDC85Z in this case?

And how to then let Wix know that the coupon has been used?