Bing Ads API - RedeemCoupon vs Search Coupon different results

Pedro Avila Castro 1 Reputation point
2022-03-15T17:22:15.13+00:00

Hello, I'm having some problems managing coupons from API.

I obtain different results using this two operations: RedeemCoupon and SearchCoupons. In my app I want to give coupons to users and check if they have redeemed them.

To test it I have a coupon which has been already redeemed.

For the same user credentials, for SearchCoupons I obtain an empty coupons list, whereas when I use ReedemCoupon the response is that this coupon is already redeemed.

Why it does not appear in the SearchCoupons response?
For the CUSTOMER_ID I use the customer_id of my account.

Here you can see my requests.

SearchCoupons

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Header>
        <AuthenticationToken xmlns="https://bingads.microsoft.com/Billing/v13">TOKEN</AuthenticationToken>
        <DeveloperToken xmlns="https://bingads.microsoft.com/Billing/v13">DEV_TOKEN</DeveloperToken>
    </Header>
    <Body>
        <SearchCouponsRequest xmlns="https://bingads.microsoft.com/Billing/v13">
            <!-- Optional -->
            <Predicates>
                <Predicate xmlns="https://bingads.microsoft.com/Customer/v13/Entities">
                    <Field>CustomerId</Field>
                    <Operator>Equals</Operator>
                    <Value>customer_id</Value>
                </Predicate>
            </Predicates>
            <Ordering>
                <OrderBy>
                    <Field>CouponStartDate</Field>
                    <Order>Ascending</Order>
                </OrderBy>
            </Ordering>
            <!-- Optional -->
            <PageInfo>
                <Index xmlns="https://bingads.microsoft.com/Customer/v13/Entities">0</Index>
                <Size xmlns="https://bingads.microsoft.com/Customer/v13/Entities">100</Size>
            </PageInfo>
        </SearchCouponsRequest>
    </Body>
</Envelope>

Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:TrackingId xmlns:h="https://bingads.microsoft.com/Billing/v13">5fb454f4-b652-4769-855a-79479830e5f1</h:TrackingId>
    </s:Header>
    <s:Body>
        <SearchCouponsResponse xmlns="https://bingads.microsoft.com/Billing/v13">
            <Coupons xmlns:a="https://bingads.microsoft.com/Customer/v13/Entities" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/>
        </SearchCouponsResponse>
    </s:Body>
</s:Envelope>

RedeemCoupon

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Header>
        <AuthenticationToken xmlns="https://bingads.microsoft.com/Billing/v13">TOKEN</AuthenticationToken>
        <DeveloperToken xmlns="https://bingads.microsoft.com/Billing/v13">DEV_TOKEN</DeveloperToken>
    </Header>
    <Body>
        <RedeemCouponRequest xmlns="https://bingads.microsoft.com/Billing/v13">
            <AccountId>ACCOUNT_ID</AccountId>
            <CouponCode>COUPON_CODE</CouponCode>
        </RedeemCouponRequest>
    </Body>
</Envelope>

Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode>s:Server</faultcode>
            <faultstring xml:lang="en-US">Invalid client data. Check the SOAP fault details for more information. TrackingId: 0aa3664e-168d-421a-b73c-f16fc02dbe13.</faultstring>
            <detail>
                <ApiFault xmlns="https://bingads.microsoft.com/Billing/v13" xmlns:a="https://bingads.microsoft.com/Customer/v13/Exception" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                    <TrackingId xmlns="https://adapi.microsoft.com">0aa3664e-168d-421a-b73c-f16fc02dbe13</TrackingId>
                    <a:OperationErrors>
                        <a:OperationError>
                            <a:Code>2506</a:Code>
                            <a:Details/>
                            <a:Message>Customer has already redeemed this onetime offer coupon before on this account.</a:Message>
                        </a:OperationError>
                    </a:OperationErrors>
                </ApiFault>
            </detail>
        </s:Fault>
    </s:Body>
</s:Envelope>

Thank you, any help is appreciated.

Microsoft Advertising API
Microsoft Advertising API
A Microsoft API that provides programmatic access to Microsoft Advertising to manage large campaigns or to integrate your marketing with other in-house systems.
399 questions
0 comments No comments
{count} votes