Facing issue with Transaction API


#21

Hi @Programmusic

I would like to know if you have a specific intent in your model.json, like TransactionCheckRequirementsIntent or something.

Secondly, is this required?

  new GoogleAssistant({

    transactions: {

        androidPackageName: ‘com.example.app’,

        keyFile: require(’…/jovoumu-177497d256a7.json’)

    }

  }),

Or can it be commented?

I would also like to know if you’re using dialogflow integration on google actions, or a fully actions project.

Thank you


#22

Hi,
I used the Dialogflow integartion.

I didnt use the the androidPackaName field

My code is in the app.js and looks like this - NOTE THAT THE ON TRANSACTION WRAPS the other intents

ON_TRANSACTION: {

 //1. check customer can transact
   TRANSACTION_REQUIREMENTS_CHECK() {
       if (this.$googleAction.$transaction.canTransact()) {
        //Do stuff here  including handle available surfaces and ask for delivery addres
      }
  }

 //2. get and set your delivery options or handle if delivery address is rejected and 
   // build the order 
  DELIVERY_ADDRESS() {
       ....
   //set your orderOptions & PresentationOptions
   this.$googleAction.$transaction.buildOrder(order, presentationOptions, 
  orderOptions);
 }

//3. get the transaction decision
TRANSACTION_DECISION() {
    const attributes = this.$session.$data;
    let result = this.$googleAction.$transaction.getTransactionDecisionResult();
    attributes.result = result
      ....
    / / Do stuff depening on result fo decision
 }

} // Close main ON_TRANSACTION intent

Hope that helps.

It is the basic structure I used. I’ve omitted a lot of the code that use as it wouldn’t be relevant to you I don’t think. If you have further, more detailed questions feel free to ask. Bear in mind I’m in Australia so you may not get an immediate response!

Also bear in mind when you submit to google you must state you are using the Transactions API. Certification can take 4 weeks and if they reject for anything (not necessarily to do with transactions) you may have to wait weeks again -so be careful to go over your code and check for any stupid mistakes that might stop certification


#23

Thanks! I have solved it, both for reservations and for physical orders. Although for reservations I cannot make the payment, but it seems that Jovo does not give that option. However, in neither case have I been able to see the payment of the physical order. I am not very clear how it is done. I have created an account in Stripe and I have bound the public key in the checkRequirements method. When I invoke my skill and try to pay, it says that the payment was made correctly, but I don’t see it in the Payments section of Google Assistant, I guess because I’m using the sandbox. Still … it seems very strange to me


#24

Good to hear you solved it. The payment should show in your google account likewise the reservation. Its quite annoying because it stays in your account even though it’s a test transaction. I could find no way of deleting it