Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1325

Simulate terminal based payments

$
0
0

I can create a checkout item and get a status but how do I simulate tapping the card on the termainl to move my payment from PENDING to PAID?

    def create_checkout(self, amount):
        checkout = {
            "checkout": {
                "amount_money": {
                    "amount": amount,
                    "currency": "GBP"
                },
                "device_options": {
                    "device_id": self._config["device_id"],
                },
            },
            "idempotency_key": str(uuid4()),
        }
        data = json.dumps(checkout)
        j = req(f"{API_URL}/v2/terminals/checkouts",
                    data=data,
                    headers=self.HEADERS,
                    method="post")
        id = j["checkout"]["id"]
        return id

    def get_checkout(self, checkout_id):
        j = req(f"{API_URL}/v2/terminals/checkouts/{checkout_id}", headers=self.HEADERS)
        status = j["checkout"]["status"]
        return status

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1325

Trending Articles