applicationUsername.toLowerCase is not a function at PromotionalOfferSignatureCreator.createSignature
orre1996 opened this issue · comments
I'm following the documentation and try to create a signature like the following
const signatureCreator = new PromotionalOfferSignatureCreator(encodedKey, keyId, bundleId)
const signature = signatureCreator.createSignature(productId, subscriptionOfferId, signatureCreator)
but when I call my code I get an error saying applicationUsername.toLowerCase is not a function. Has anyone else run into this problem? I have a node.js server
What are you passing as the input for applicationUsername ?
I realised the documentation is wrong here https://github.com/apple/app-store-server-library-node
const signature = signatureCreator.createSignature(productId, subscriptionOfferId, signatureCreator)
is not correct, it should be:
public createSignature(productIdentifier: string, subscriptionOfferID: string, applicationUsername: string, nonce: string, timestamp: number): string {
I do have some more issues though, probably not something wrong with the library, I just keep getting error 12 which I guess is that the signature is wrong. Can you help me?
@orre1996 Thank you for pointing out the mistake in the examples, I've corrected them. The full reference for that class is listed in our documentation https://apple.github.io/app-store-server-library-node/classes/PromotionalOfferSignatureCreator.html
I do have some more issues though, probably not something wrong with the library, I just keep getting error 12 which I guess is that the signature is wrong. Can you help me?
Error 12 from what exactly?
Error 12 when I try to make a purchase in my app and then it says invalid signature. I put it aside for now because I didn't realise promotional offers are only for people who have or are already subscribed which isn't what I want atm. Thanks for the help!